Class: Trackler::Metadata
- Inherits:
-
Object
- Object
- Trackler::Metadata
- Defined in:
- lib/trackler/metadata.rb
Instance Attribute Summary collapse
-
#blurb ⇒ Object
Returns the value of attribute blurb.
-
#source ⇒ Object
Returns the value of attribute source.
-
#source_url ⇒ Object
Returns the value of attribute source_url.
Class Method Summary collapse
Instance Method Summary collapse
- #exists? ⇒ Boolean
-
#initialize(metadata_file) ⇒ Metadata
constructor
A new instance of Metadata.
- #url ⇒ Object
Constructor Details
#initialize(metadata_file) ⇒ Metadata
Returns a new instance of Metadata.
11 12 13 14 15 16 17 |
# File 'lib/trackler/metadata.rb', line 11 def initialize() @file = @attrs = YAML.load(@file.content) || {} %w(blurb source source_url).each do |attr| self.send("#{attr}=".to_sym, @attrs[attr].to_s.strip) end end |
Instance Attribute Details
#blurb ⇒ Object
Returns the value of attribute blurb.
9 10 11 |
# File 'lib/trackler/metadata.rb', line 9 def blurb @blurb end |
#source ⇒ Object
Returns the value of attribute source.
9 10 11 |
# File 'lib/trackler/metadata.rb', line 9 def source @source end |
#source_url ⇒ Object
Returns the value of attribute source_url.
9 10 11 |
# File 'lib/trackler/metadata.rb', line 9 def source_url @source_url end |
Class Method Details
.for(specification:, track:) ⇒ Object
5 6 7 |
# File 'lib/trackler/metadata.rb', line 5 def self.for(specification: , track: ) new(GuaranteedFile.for(specification: specification, track: track, filename: 'metadata.yml')) end |
Instance Method Details
#exists? ⇒ Boolean
23 24 25 |
# File 'lib/trackler/metadata.rb', line 23 def exists? !@attrs.empty? end |
#url ⇒ Object
19 20 21 |
# File 'lib/trackler/metadata.rb', line 19 def url @file.url end |