Class: Playlist::Contributor

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(attr = nil) {|_self| ... } ⇒ Contributor

Create a new Contributor

Yields:

  • (_self)

Yield Parameters:



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

#identifiersHash (readonly)

Get a hash of identifier for this Contributor Identifiers can either be Strings or URIs

Returns:

  • (Hash)

    an hash of identifiers



12
13
14
# File 'lib/playlist/contributor.rb', line 12

def identifiers
  @identifiers
end

#nameString

The name of the contributor

Returns:

  • (String)


7
8
9
# File 'lib/playlist/contributor.rb', line 7

def name
  @name
end

#roleSymbol

The role of the contribrition to the track

Recommended values for role:

:performer
:composer
:arranger
:lyricist

Returns:

  • (Symbol)


22
23
24
# File 'lib/playlist/contributor.rb', line 22

def role
  @role
end