Class: MusicBrainz::Model::Individual

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

Direct Known Subclasses

Artist, Label

Constant Summary

Constants inherited from Entity

Entity::ENTITY_TYPE

Instance Attribute Summary collapse

Attributes included from Rateable

#rating, #user_rating

Attributes inherited from Entity

#id

Instance Method Summary collapse

Methods included from Taggable

#tags, #user_tags

Methods included from Relateable

#add_relation, #get_relations, #relation_target_types

Methods inherited from Entity

entity_type, #entity_type

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

#aliasesObject (readonly)

Collection of alternate names, including possible typos.



42
43
44
# File 'lib/rbrainz/model/individual.rb', line 42

def aliases
  @aliases
end

#begin_dateObject

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

#disambiguationObject

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_dateObject

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

#nameObject

The name of the artist or label.



29
30
31
# File 'lib/rbrainz/model/individual.rb', line 29

def name
  @name
end

#releasesObject (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_nameObject

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

#typeObject

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_sObject

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_nameObject

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