Class: MediaWikiLyrics::TrackData
- Inherits:
-
Object
- Object
- MediaWikiLyrics::TrackData
- Defined in:
- lib/lyrics/mediawikilyrics.rb
Instance Attribute Summary collapse
-
#artist ⇒ Object
readonly
Returns the value of attribute artist.
-
#genre ⇒ Object
readonly
Returns the value of attribute genre.
-
#length ⇒ Object
readonly
Returns the value of attribute length.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#year ⇒ Object
readonly
Returns the value of attribute year.
Instance Method Summary collapse
-
#initialize(artist, title, length = nil, genre = nil) ⇒ TrackData
constructor
A new instance of TrackData.
Constructor Details
#initialize(artist, title, length = nil, genre = nil) ⇒ TrackData
Returns a new instance of TrackData.
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/lyrics/mediawikilyrics.rb', line 38 def initialize( artist, title, length=nil, genre=nil ) @artist = artist.strip().freeze() @title = title.strip().freeze() @length = 0 if length tokens = length.to_s().split( ":" ).reverse() tokens.size.times() { |idx| @length += (60**idx) * tokens[idx].strip().to_i() } end @genre = genre ? genre.strip().freeze() : nil end |
Instance Attribute Details
#artist ⇒ Object (readonly)
Returns the value of attribute artist.
36 37 38 |
# File 'lib/lyrics/mediawikilyrics.rb', line 36 def artist @artist end |
#genre ⇒ Object (readonly)
Returns the value of attribute genre.
36 37 38 |
# File 'lib/lyrics/mediawikilyrics.rb', line 36 def genre @genre end |
#length ⇒ Object (readonly)
Returns the value of attribute length.
36 37 38 |
# File 'lib/lyrics/mediawikilyrics.rb', line 36 def length @length end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
36 37 38 |
# File 'lib/lyrics/mediawikilyrics.rb', line 36 def title @title end |
#year ⇒ Object (readonly)
Returns the value of attribute year.
36 37 38 |
# File 'lib/lyrics/mediawikilyrics.rb', line 36 def year @year end |