Class: MediaWikiLyrics::SongData
- Inherits:
-
Object
- Object
- MediaWikiLyrics::SongData
- Defined in:
- lib/lyrics/mediawikilyrics.rb
Instance Attribute Summary collapse
-
#album ⇒ Object
readonly
Returns the value of attribute album.
-
#artist ⇒ Object
readonly
Returns the value of attribute artist.
-
#credits ⇒ Object
readonly
Returns the value of attribute credits.
-
#lyricists ⇒ Object
readonly
Returns the value of attribute lyricists.
-
#lyrics ⇒ Object
readonly
Returns the value of attribute lyrics.
-
#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, lyrics, album = nil, year = nil, credits = nil, lyricists = nil) ⇒ SongData
constructor
A new instance of SongData.
- #instrumental? ⇒ Boolean
Constructor Details
#initialize(artist, title, lyrics, album = nil, year = nil, credits = nil, lyricists = nil) ⇒ SongData
Returns a new instance of SongData.
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/lyrics/mediawikilyrics.rb', line 100 def initialize( artist, title, lyrics, album=nil, year=nil, credits=nil, lyricists=nil ) raise "artist and title values can't be nil" if ! artist || ! title @artist = artist.strip().freeze() @title = title.strip().freeze() @lyrics = lyrics ? lyrics.strip().freeze() : nil @album = album ? album.strip().freeze() : nil @year = year.kind_of?( String ) ? year.strip().to_i() : year.to_i() credits = credits.split( ";" ) if credits.is_a?( String ) @credits = [] credits.each() { |value| @credits << value.strip().freeze() } if credits.is_a?( Array ) @credits.freeze() lyricists = lyricists.split( ";" ) if lyricists.is_a?( String ) @lyricists = [] lyricists.each() { |value| @lyricists << value.strip().freeze() } if lyricists.is_a?( Array ) @lyricists.freeze() end |
Instance Attribute Details
#album ⇒ Object (readonly)
Returns the value of attribute album.
98 99 100 |
# File 'lib/lyrics/mediawikilyrics.rb', line 98 def album @album end |
#artist ⇒ Object (readonly)
Returns the value of attribute artist.
98 99 100 |
# File 'lib/lyrics/mediawikilyrics.rb', line 98 def artist @artist end |
#credits ⇒ Object (readonly)
Returns the value of attribute credits.
98 99 100 |
# File 'lib/lyrics/mediawikilyrics.rb', line 98 def credits @credits end |
#lyricists ⇒ Object (readonly)
Returns the value of attribute lyricists.
98 99 100 |
# File 'lib/lyrics/mediawikilyrics.rb', line 98 def lyricists @lyricists end |
#lyrics ⇒ Object (readonly)
Returns the value of attribute lyrics.
98 99 100 |
# File 'lib/lyrics/mediawikilyrics.rb', line 98 def lyrics @lyrics end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
98 99 100 |
# File 'lib/lyrics/mediawikilyrics.rb', line 98 def title @title end |
#year ⇒ Object (readonly)
Returns the value of attribute year.
98 99 100 |
# File 'lib/lyrics/mediawikilyrics.rb', line 98 def year @year end |
Instance Method Details
#instrumental? ⇒ Boolean
122 123 124 |
# File 'lib/lyrics/mediawikilyrics.rb', line 122 def instrumental?() return @lyrics == nil end |