47: def collect
48: real_path = full_path
49: stat = stat()
50: @owner = stat.uid
51: @group = stat.gid
52: @ftype = stat.ftype
53:
54:
55:
56: @mode = stat.mode & 007777
57:
58: case stat.ftype
59: when "file"
60: @checksum = ("{#{@checksum_type}}") + send("#{@checksum_type}_file", real_path).to_s
61: when "directory"
62: @checksum_type = "ctime"
63: @checksum = ("{#{@checksum_type}}") + send("#{@checksum_type}_file", path).to_s
64: when "link"
65: @destination = File.readlink(real_path)
66: @checksum = ("{#{@checksum_type}}") + send("#{@checksum_type}_file", real_path).to_s rescue nil
67: else
68: raise ArgumentError, "Cannot manage files of type #{stat.ftype}"
69: end
70: end