Class: Playlist::Contributor
- Inherits:
-
Object
- Object
- Playlist::Contributor
- Defined in:
- lib/playlist/contributor.rb
Overview
Data model class that represents a contributor to a track. A Contrutor can be a person, or a organisation (such an band, choir or orchestra).
Instance Attribute Summary collapse
-
#identifiers ⇒ Hash
readonly
Get a hash of identifier for this Contributor Identifiers can either be Strings or URIs.
-
#name ⇒ String
The name of the contributor.
-
#role ⇒ Symbol
The role of the contribrition to the track.
Instance Method Summary collapse
-
#initialize(attr = nil) {|_self| ... } ⇒ Contributor
constructor
Create a new Contributor.
Constructor Details
#initialize(attr = nil) {|_self| ... } ⇒ Contributor
Create a new Contributor
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/playlist/contributor.rb', line 25 def initialize(attr = nil) @identifiers = {} if attr.is_a?(Hash) attr.each_pair do |key, value| send("#{key}=", value) end elsif attr.is_a?(String) self.name = attr end yield(self) if block_given? end |
Instance Attribute Details
#identifiers ⇒ Hash (readonly)
Get a hash of identifier for this Contributor Identifiers can either be Strings or URIs
12 13 14 |
# File 'lib/playlist/contributor.rb', line 12 def identifiers @identifiers end |
#name ⇒ String
The name of the contributor
7 8 9 |
# File 'lib/playlist/contributor.rb', line 7 def name @name end |
#role ⇒ Symbol
The role of the contribrition to the track
Recommended values for role:
:performer
:composer
:arranger
:lyricist
22 23 24 |
# File 'lib/playlist/contributor.rb', line 22 def role @role end |