Class: EivuFingerprinterAcoustid::Objects::Recording
- Defined in:
- lib/eivu_fingerprinter_acoustid/objects/recording.rb
Instance Attribute Summary collapse
-
#artists ⇒ Object
readonly
Returns the value of attribute artists.
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#releasegroups ⇒ Object
(also: #release_groups)
readonly
Returns the value of attribute releasegroups.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(id:, title: nil, artists: [], release_groups: [], releasegroups: [], duration: nil) ⇒ Recording
constructor
A new instance of Recording.
-
#shallow_clone ⇒ Object
will delete before completion.
Methods inherited from BaseClass
Constructor Details
#initialize(id:, title: nil, artists: [], release_groups: [], releasegroups: [], duration: nil) ⇒ Recording
Returns a new instance of Recording.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/eivu_fingerprinter_acoustid/objects/recording.rb', line 10 def initialize(id:, title: nil, artists: [], release_groups: [], releasegroups: [], duration: nil) if release_groups.present? && releasegroups.present? raise ArgumentError, 'can not pass in both release_groups AND releasegroups to constructor' end @id = id @duration = duration @title = title @artists = instantiate_artists(artists) @releasegroups = releasegroups.collect do |rg| case rg.class.name when 'Hash' EivuFingerprinterAcoustid::Objects::ReleaseGroup.new(**rg) when 'EivuFingerprinterAcoustid::Objects::ReleaseGroup' rg else raise ArgumentError, "Mismatched Type: #{rg.class} passed to create release group" end end end |
Instance Attribute Details
#artists ⇒ Object (readonly)
Returns the value of attribute artists.
8 9 10 |
# File 'lib/eivu_fingerprinter_acoustid/objects/recording.rb', line 8 def artists @artists end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
8 9 10 |
# File 'lib/eivu_fingerprinter_acoustid/objects/recording.rb', line 8 def duration @duration end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/eivu_fingerprinter_acoustid/objects/recording.rb', line 8 def id @id end |
#releasegroups ⇒ Object (readonly) Also known as: release_groups
Returns the value of attribute releasegroups.
8 9 10 |
# File 'lib/eivu_fingerprinter_acoustid/objects/recording.rb', line 8 def releasegroups @releasegroups end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
8 9 10 |
# File 'lib/eivu_fingerprinter_acoustid/objects/recording.rb', line 8 def title @title end |
Instance Method Details
#shallow_clone ⇒ Object
will delete before completion
32 33 34 |
# File 'lib/eivu_fingerprinter_acoustid/objects/recording.rb', line 32 def shallow_clone EivuFingerprinterAcoustid::Objects::Recording.new(id: id, title: title, artists: artists, releasegroups: [], duration: duration) end |