Class: BlipFm::Song

Inherits:
Object
  • Object
show all
Defined in:
lib/blipfm.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#artistObject (readonly)

Returns the value of attribute artist.



279
280
281
# File 'lib/blipfm.rb', line 279

def artist
  @artist
end

#bitrateObject (readonly)

Returns the value of attribute bitrate.



279
280
281
# File 'lib/blipfm.rb', line 279

def bitrate
  @bitrate
end

#durationObject (readonly)

Returns the value of attribute duration.



279
280
281
# File 'lib/blipfm.rb', line 279

def duration
  @duration
end

#genreObject (readonly)

Returns the value of attribute genre.



279
280
281
# File 'lib/blipfm.rb', line 279

def genre
  @genre
end

#locationObject (readonly)

Returns the value of attribute location.



279
280
281
# File 'lib/blipfm.rb', line 279

def location
  @location
end

#titleObject (readonly)

Returns the value of attribute title.



279
280
281
# File 'lib/blipfm.rb', line 279

def title
  @title
end

#typeObject (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