Class: Checkm::Entry
- Inherits:
-
Object
- Object
- Checkm::Entry
- Defined in:
- lib/checkm.rb
Constant Summary collapse
- CHUNK_SIZE =
8*1024*1024
- BASE_FIELDS =
['sourcefileorurl', 'alg', 'digest', 'length', 'modtime', 'targetfileorurl']
Instance Attribute Summary collapse
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Instance Method Summary collapse
-
#initialize(line, manifest = nil) ⇒ Entry
constructor
A new instance of Entry.
- #method_missing(sym, *args, &block) ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(line, manifest = nil) ⇒ Entry
Returns a new instance of Entry.
81 82 83 84 85 86 87 88 |
# File 'lib/checkm.rb', line 81 def initialize line, manifest = nil @line = line.strip @include = false @fields = BASE_FIELDS @fields = manifest.fields if manifest and manifest.fields @values = line.split('|').map { |s| s.strip } @manifest = manifest end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
90 91 92 |
# File 'lib/checkm.rb', line 90 def method_missing(sym, *args, &block) @values[@fields.index(sym.to_s.downcase) || BASE_FIELDS.index(sym.to_s.downcase)] rescue nil end |
Instance Attribute Details
#values ⇒ Object (readonly)
Returns the value of attribute values.
79 80 81 |
# File 'lib/checkm.rb', line 79 def values @values end |
Instance Method Details
#valid? ⇒ Boolean
95 96 97 |
# File 'lib/checkm.rb', line 95 def valid? return source_exists? && valid_checksum? && valid_multilevel? # xxx && valid_length? && valid_modtime? end |