Class: MusicBrainz::Model::Individual
- Includes:
- Rateable, Relateable, Taggable
- Defined in:
- lib/rbrainz/model/individual.rb
Overview
Superclass for Artist and Label.
Aggregates the common attributes of artists and labels.
Constant Summary
Constants inherited from Entity
Instance Attribute Summary collapse
-
#aliases ⇒ Object
readonly
Collection of alternate names, including possible typos.
-
#begin_date ⇒ Object
The begin date is interpreted differently for bands, individual artists and labels.
-
#disambiguation ⇒ Object
Field to distinguish between identically named artists or labels.
-
#end_date ⇒ Object
The end date is interpreted differently for bands, individual artists and labels.
-
#name ⇒ Object
The name of the artist or label.
-
#releases ⇒ Object
readonly
A Collection of releases of this artist or label.
-
#sort_name ⇒ Object
Name used for sorting (e.g. “White Stripes, The”).
-
#type ⇒ Object
The type of this artist or label.
Attributes included from Rateable
Attributes inherited from Entity
Instance Method Summary collapse
-
#initialize(id = nil, type = nil, name = nil, sort_name = nil) ⇒ Individual
constructor
A new instance of Individual.
-
#to_s ⇒ Object
Returns the string representation for this individual.
-
#unique_name ⇒ Object
Returns a unique name for the individual (using disambiguation).
Methods included from Taggable
Methods included from Relateable
#add_relation, #get_relations, #relation_target_types
Methods inherited from Entity
Constructor Details
#initialize(id = nil, type = nil, name = nil, sort_name = nil) ⇒ Individual
Returns a new instance of Individual.
63 64 65 66 67 68 69 70 |
# File 'lib/rbrainz/model/individual.rb', line 63 def initialize(id=nil, type=nil, name=nil, sort_name=nil) super id self.type = type self.name = name self.sort_name = sort_name @aliases = Collection.new @releases = Collection.new end |
Instance Attribute Details
#aliases ⇒ Object (readonly)
Collection of alternate names, including possible typos.
42 43 44 |
# File 'lib/rbrainz/model/individual.rb', line 42 def aliases @aliases end |
#begin_date ⇒ Object
The begin date is interpreted differently for bands, individual artists and labels. For bands and labels this is the founding date, for individual artists it is the date of birth. The begin date is an instance of IncompleteDate.
48 49 50 |
# File 'lib/rbrainz/model/individual.rb', line 48 def begin_date @begin_date end |
#disambiguation ⇒ Object
Field to distinguish between identically named artists or labels.
35 36 37 |
# File 'lib/rbrainz/model/individual.rb', line 35 def disambiguation @disambiguation end |
#end_date ⇒ Object
The end date is interpreted differently for bands, individual artists and labels. For bands and labels this is the breakup date, for individual artists it is the date of death. The end date is an instance of IncompleteDate.
54 55 56 |
# File 'lib/rbrainz/model/individual.rb', line 54 def end_date @end_date end |
#name ⇒ Object
The name of the artist or label.
29 30 31 |
# File 'lib/rbrainz/model/individual.rb', line 29 def name @name end |
#releases ⇒ Object (readonly)
A Collection of releases of this artist or label.
This may also include releases where this artist isn’t the main artist but has just contributed one or more tracks (aka VA-Releases).
61 62 63 |
# File 'lib/rbrainz/model/individual.rb', line 61 def releases @releases end |
#sort_name ⇒ Object
Name used for sorting (e.g. “White Stripes, The”).
32 33 34 |
# File 'lib/rbrainz/model/individual.rb', line 32 def sort_name @sort_name end |
#type ⇒ Object
The type of this artist or label. See the constants defined in Artist and Label for a list of possible types.
39 40 41 |
# File 'lib/rbrainz/model/individual.rb', line 39 def type @type end |
Instance Method Details
#to_s ⇒ Object
Returns the string representation for this individual.
Returns #unique_name converted into a string.
105 106 107 |
# File 'lib/rbrainz/model/individual.rb', line 105 def to_s unique_name.to_s end |
#unique_name ⇒ Object
Returns a unique name for the individual (using disambiguation).
The unique name ist the individual’s name together with the disambiguation attribute in parenthesis if it exists.
- Example
-
‘Paradise Lost (British metal / hard rock band)’.
96 97 98 99 100 |
# File 'lib/rbrainz/model/individual.rb', line 96 def unique_name unique_name = @name unique_name += " (#{@disambiguation})" if @disambiguation return unique_name end |