Class: BlipFm::Song
- Inherits:
-
Object
- Object
- BlipFm::Song
- Defined in:
- lib/blipfm.rb
Instance Attribute Summary collapse
-
#artist ⇒ Object
readonly
Returns the value of attribute artist.
-
#bitrate ⇒ Object
readonly
Returns the value of attribute bitrate.
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#genre ⇒ Object
readonly
Returns the value of attribute genre.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(location, title, artist, bitrate, genre, duration, type) ⇒ Song
constructor
A new instance of Song.
Constructor Details
#initialize(location, title, artist, bitrate, genre, duration, type) ⇒ Song
Returns a new instance of Song.
294 295 296 297 298 299 300 301 302 |
# File 'lib/blipfm.rb', line 294 def initialize(location, title, artist, bitrate, genre, duration, type) @location = if_nill(location).strip @title = if_nill(title).strip @artist = if_nill(artist).strip @bitrate = if_nill(bitrate).strip @genre = if_nill(genre).strip @duration = if_nill(duration).strip @type = if_nill(type).strip end |
Instance Attribute Details
#artist ⇒ Object (readonly)
Returns the value of attribute artist.
279 280 281 |
# File 'lib/blipfm.rb', line 279 def artist @artist end |
#bitrate ⇒ Object (readonly)
Returns the value of attribute bitrate.
279 280 281 |
# File 'lib/blipfm.rb', line 279 def bitrate @bitrate end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
279 280 281 |
# File 'lib/blipfm.rb', line 279 def duration @duration end |
#genre ⇒ Object (readonly)
Returns the value of attribute genre.
279 280 281 |
# File 'lib/blipfm.rb', line 279 def genre @genre end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
279 280 281 |
# File 'lib/blipfm.rb', line 279 def location @location end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
279 280 281 |
# File 'lib/blipfm.rb', line 279 def title @title end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
279 280 281 |
# File 'lib/blipfm.rb', line 279 def type @type end |
Class Method Details
.create_by_xml(song_xml) ⇒ Object
281 282 283 284 285 286 287 288 289 290 291 292 |
# File 'lib/blipfm.rb', line 281 def Song.create_by_xml(song_xml) location = song_xml.elements['location'].text title = song_xml.elements['title'].text artist = song_xml.elements['artist'].text bitrate = song_xml.elements['bitrate'].text genre = song_xml.elements['genre'].text duration = song_xml.elements['duration'].text type = song_xml.elements['blipType'].text Song.new(location, title, artist, bitrate, genre, duration, type) end |