Class: Scrobble::Track
Instance Attribute Summary collapse
-
#album ⇒ Object
FIXME: We really want this to be attr_reader, but new_from_element needs to write.
-
#artist ⇒ Object
FIXME: We really want this to be attr_reader, but new_from_element needs to write.
-
#name ⇒ Object
FIXME: We really want this to be attr_reader, but new_from_element needs to write.
-
#now_playing ⇒ Object
Returns the value of attribute now_playing.
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Base
Instance Attribute Details
#album ⇒ Object
FIXME: We really want this to be attr_reader, but new_from_element needs to write. Perhaps emulate Rails’ ability to pass a block.
4 5 6 |
# File 'lib/scrobble/track.rb', line 4 def album @album end |
#artist ⇒ Object
FIXME: We really want this to be attr_reader, but new_from_element needs to write. Perhaps emulate Rails’ ability to pass a block.
4 5 6 |
# File 'lib/scrobble/track.rb', line 4 def artist @artist end |
#name ⇒ Object
FIXME: We really want this to be attr_reader, but new_from_element needs to write. Perhaps emulate Rails’ ability to pass a block.
4 5 6 |
# File 'lib/scrobble/track.rb', line 4 def name @name end |
#now_playing ⇒ Object
Returns the value of attribute now_playing.
5 6 7 |
# File 'lib/scrobble/track.rb', line 5 def @now_playing end |
Class Method Details
.new_from_element(element, doc) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/scrobble/track.rb', line 7 def self.new_from_element( element, doc ) t = Track.new t. = !!element[ "nowplaying" ] t.name = (element/"name").inner_text t.artist = (element/"artist").inner_text t.album = (element/"album").inner_text t end |
Instance Method Details
#now_playing? ⇒ Boolean
19 20 21 |
# File 'lib/scrobble/track.rb', line 19 def end |