Class: FileTreeProfiler::DataFile
- Inherits:
-
File
- Object
- File
- FileTreeProfiler::DataFile
show all
- Defined in:
- lib/file_tree_profiler/data_file.rb
Constant Summary
collapse
- EMPTY_CHECKSUM =
::Digest::MD5.hexdigest('/no-data/').freeze
Instance Attribute Summary
Attributes inherited from File
#name, #parent
Instance Method Summary
collapse
Methods inherited from File
#initialize, #inspect, #path, #relative_path
Instance Method Details
#checksum ⇒ Object
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/file_tree_profiler/data_file.rb', line 9
def checksum
@checksum ||= begin
empty? ? EMPTY_CHECKSUM : ::Digest::MD5.file(path)
end.to_s
rescue Errno::ELOOP => e
puts "path=#{path} is a circular ref"
rescue Errno::ENOENT => e
puts "got deleted while profiling!!!"
@checksum = EMPTY_CHECKSUM
end
|
#empty? ⇒ Boolean
5
6
7
|
# File 'lib/file_tree_profiler/data_file.rb', line 5
def empty?
::File.zero?(path)
end
|
#size ⇒ Object
20
21
22
|
# File 'lib/file_tree_profiler/data_file.rb', line 20
def size
1
end
|