class MusicBox::Catalog::ReleaseArtist

Attributes

active[RW]
anv[RW]
artist[RW]
id[RW]
join[RW]
name[RW]
resource_url[RW]
role[RW]
thumbnail_url[RW]
tracks[RW]

Public Class Methods

artists_to_s(artists) click to toggle source
# File lib/musicbox/catalog/release_artist.rb, line 18
def self.artists_to_s(artists)
  artists.map do |artist|
    artist.name + ((artist.join == ',') ? artist.join : (' ' + artist.join))
  end.flatten.join(' ').squeeze(' ').strip
end
new(params={}) click to toggle source
# File lib/musicbox/catalog/release_artist.rb, line 24
def initialize(params={})
  params.each { |k, v| send("#{k}=", v) }
end

Public Instance Methods

canonical_name() click to toggle source
# File lib/musicbox/catalog/release_artist.rb, line 32
def canonical_name
  name = (@@canonical_names[@name] || @name).sub(/\s\(\d+\)/, '')  # handle 'Nico (3)'
  if @@personal_names.include?(name)
    elems = name.split(/\s+/)
    [elems[-1], elems[0..-2].join(' ')].join(', ')
  else
    name
  end
end
key() click to toggle source
# File lib/musicbox/catalog/release_artist.rb, line 42
def key
  key = ''
  tokens = canonical_name.tokenize
  while (token = tokens.shift) && key.length < 4
    if key.empty?
      key << token[0..2].capitalize
    else
      key << token[0].upcase
    end
  end
  key
end
to_s() click to toggle source
# File lib/musicbox/catalog/release_artist.rb, line 28
def to_s
  @name
end