Class: LastFM::Artist
Instance Attribute Summary collapse
-
#images ⇒ Hash
The current value of images.
-
#listeners ⇒ Fixnum
The current value of listeners.
-
#mbid ⇒ String
The current value of mbid.
-
#name ⇒ String
The current value of name.
-
#playcount ⇒ Fixnum
The current value of playcount.
-
#similar ⇒ Array
The current value of similar.
-
#streamable ⇒ Boolean
The current value of streamable.
-
#tags ⇒ Array
The current value of tags.
-
#url ⇒ String
The current value of url.
-
#wiki ⇒ LastFM::Wiki
The current value of wiki.
Instance Method Summary collapse
Methods inherited from Struct
from_xml, #initialize, package
Constructor Details
This class inherits a constructor from LastFM::Struct
Instance Attribute Details
#images ⇒ Hash
Returns the current value of images.
13 14 15 |
# File 'lib/lastfm/artist.rb', line 13 def images @images end |
#listeners ⇒ Fixnum
Returns the current value of listeners.
13 14 15 |
# File 'lib/lastfm/artist.rb', line 13 def listeners @listeners end |
#mbid ⇒ String
Returns the current value of mbid.
13 14 15 |
# File 'lib/lastfm/artist.rb', line 13 def mbid @mbid end |
#name ⇒ String
Returns the current value of name.
13 14 15 |
# File 'lib/lastfm/artist.rb', line 13 def name @name end |
#playcount ⇒ Fixnum
Returns the current value of playcount.
13 14 15 |
# File 'lib/lastfm/artist.rb', line 13 def playcount @playcount end |
#similar ⇒ Array
Returns the current value of similar.
13 14 15 |
# File 'lib/lastfm/artist.rb', line 13 def similar @similar end |
#streamable ⇒ Boolean
Returns the current value of streamable.
13 14 15 |
# File 'lib/lastfm/artist.rb', line 13 def streamable @streamable end |
#tags ⇒ Array
Returns the current value of tags.
13 14 15 |
# File 'lib/lastfm/artist.rb', line 13 def end |
#url ⇒ String
Returns the current value of url.
13 14 15 |
# File 'lib/lastfm/artist.rb', line 13 def url @url end |
#wiki ⇒ LastFM::Wiki
Returns the current value of wiki.
13 14 15 |
# File 'lib/lastfm/artist.rb', line 13 def wiki @wiki end |
Instance Method Details
#update_from_node(node) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/lastfm/artist.rb', line 15 def update_from_node(node) case node.name.to_sym when :name self.name = node.content when :mbid self.mbid = node.content when :url self.url = node.content when :image self.images ||= {} self.images.merge!({node['size'].to_sym => node.content}) when :streamable self.streamable = (node.content == '1') when :listeners self.listeners = node.content.to_i when :playcount self.playcount = node.content.to_i when :stats # nested listeners and playcount node.find('*').each{|child| self.update_from_node(child)} when :similar self.similar = node.find('artist').map do |artist| LastFM::Artist.from_xml(artist) end when :tags self. = node.find('tag').map do |tag| LastFM::Tag.from_xml(tag) end when :bio self.wiki = LastFM::Wiki.from_xml(node) end end |