Class: LastFM::Track
Instance Attribute Summary collapse
-
#album ⇒ LastFM::Album
The current value of album.
-
#artist ⇒ LastFM::Artist, String
The current value of artist.
-
#duration ⇒ Fixnum
The current value of duration.
-
#id ⇒ Fixnum
The current value of id.
-
#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.
-
#position ⇒ Fixnum
The current value of position.
-
#streamable ⇒ Boolean
The current value of streamable.
-
#streamable_fulltrack ⇒ Boolean
The current value of streamable_fulltrack.
-
#tags ⇒ Array
The current value of tags.
-
#url ⇒ String
The current value of url.
-
#wiki ⇒ LastFM::Wii
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
#album ⇒ LastFM::Album
Returns the current value of album.
18 19 20 |
# File 'lib/lastfm/track.rb', line 18 def album @album end |
#artist ⇒ LastFM::Artist, String
Returns the current value of artist.
18 19 20 |
# File 'lib/lastfm/track.rb', line 18 def artist @artist end |
#duration ⇒ Fixnum
Returns the current value of duration.
18 19 20 |
# File 'lib/lastfm/track.rb', line 18 def duration @duration end |
#id ⇒ Fixnum
Returns the current value of id.
18 19 20 |
# File 'lib/lastfm/track.rb', line 18 def id @id end |
#images ⇒ Hash
Returns the current value of images.
18 19 20 |
# File 'lib/lastfm/track.rb', line 18 def images @images end |
#listeners ⇒ Fixnum
Returns the current value of listeners.
18 19 20 |
# File 'lib/lastfm/track.rb', line 18 def listeners @listeners end |
#mbid ⇒ String
Returns the current value of mbid.
18 19 20 |
# File 'lib/lastfm/track.rb', line 18 def mbid @mbid end |
#name ⇒ String
Returns the current value of name.
18 19 20 |
# File 'lib/lastfm/track.rb', line 18 def name @name end |
#playcount ⇒ Fixnum
Returns the current value of playcount.
18 19 20 |
# File 'lib/lastfm/track.rb', line 18 def playcount @playcount end |
#position ⇒ Fixnum
Returns the current value of position.
18 19 20 |
# File 'lib/lastfm/track.rb', line 18 def position @position end |
#streamable ⇒ Boolean
Returns the current value of streamable.
18 19 20 |
# File 'lib/lastfm/track.rb', line 18 def streamable @streamable end |
#streamable_fulltrack ⇒ Boolean
Returns the current value of streamable_fulltrack.
18 19 20 |
# File 'lib/lastfm/track.rb', line 18 def streamable_fulltrack @streamable_fulltrack end |
#tags ⇒ Array
Returns the current value of tags.
18 19 20 |
# File 'lib/lastfm/track.rb', line 18 def end |
#url ⇒ String
Returns the current value of url.
18 19 20 |
# File 'lib/lastfm/track.rb', line 18 def url @url end |
#wiki ⇒ LastFM::Wii
Returns the current value of wiki.
18 19 20 |
# File 'lib/lastfm/track.rb', line 18 def wiki @wiki end |
Instance Method Details
#update_from_node(node) ⇒ Object
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 46 47 48 49 50 51 52 53 54 |
# File 'lib/lastfm/track.rb', line 20 def update_from_node(node) case node.name.to_sym when :name self.name = node.content when :id self.id = node.content.to_i when :duration self.duration = node.content.to_i when :mbid self.mbid = node.content when :url self.url = node.content when :listeners self.listeners = node.content.to_i when :playcount self.playcount = node.content.to_i when :streamable self.streamable = (node.content == '1') self.streamable_fulltrack = (node['fulltrack'] == '1') when :image self.images ||= {} self.images.merge!({node['size'].to_sym => node.content}) when :artist self.artist = (node.find('*').count == 0) ? node.content : LastFM::Artist.from_xml(node) when :album self.position = node['position'].to_i self.album = LastFM::Album.from_xml(node) when :toptags self. = node.find('tag').map do |tag| LastFM::Tag.from_xml(tag) end when :wiki self.wiki = LastFM::Wiki.from_xml(node) end end |