Class: TheFox::MBDB::Record
- Inherits:
-
Object
- Object
- TheFox::MBDB::Record
- Defined in:
- lib/mbdb/record.rb
Instance Attribute Summary collapse
-
#domain ⇒ Object
Returns the value of attribute domain.
-
#file_size ⇒ Object
Returns the value of attribute file_size.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize ⇒ Record
constructor
A new instance of Record.
- #is_file? ⇒ Boolean
- #src_file_name ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ Record
Returns a new instance of Record.
14 15 16 17 18 19 |
# File 'lib/mbdb/record.rb', line 14 def initialize @domain_name = '' @domain = nil @path = '' @file_size = 0 end |
Instance Attribute Details
#domain ⇒ Object
Returns the value of attribute domain.
10 11 12 |
# File 'lib/mbdb/record.rb', line 10 def domain @domain end |
#file_size ⇒ Object
Returns the value of attribute file_size.
12 13 14 |
# File 'lib/mbdb/record.rb', line 12 def file_size @file_size end |
#path ⇒ Object
Returns the value of attribute path.
11 12 13 |
# File 'lib/mbdb/record.rb', line 11 def path @path end |
Instance Method Details
#is_file? ⇒ Boolean
32 33 34 |
# File 'lib/mbdb/record.rb', line 32 def is_file? @file_size > 0 end |
#src_file_name ⇒ Object
28 29 30 |
# File 'lib/mbdb/record.rb', line 28 def src_file_name Pathname.new(Digest::SHA1.hexdigest("#{@domain_name}-#{@path}")) end |
#to_s ⇒ Object
36 37 38 |
# File 'lib/mbdb/record.rb', line 36 def to_s "#{@domain}@#{@path}" end |