Class: MediaWikiLyrics::SongData

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#albumObject (readonly)

Returns the value of attribute album.



98
99
100
# File 'lib/lyrics/mediawikilyrics.rb', line 98

def album
  @album
end

#artistObject (readonly)

Returns the value of attribute artist.



98
99
100
# File 'lib/lyrics/mediawikilyrics.rb', line 98

def artist
  @artist
end

#creditsObject (readonly)

Returns the value of attribute credits.



98
99
100
# File 'lib/lyrics/mediawikilyrics.rb', line 98

def credits
  @credits
end

#lyricistsObject (readonly)

Returns the value of attribute lyricists.



98
99
100
# File 'lib/lyrics/mediawikilyrics.rb', line 98

def lyricists
  @lyricists
end

#lyricsObject (readonly)

Returns the value of attribute lyrics.



98
99
100
# File 'lib/lyrics/mediawikilyrics.rb', line 98

def lyrics
  @lyrics
end

#titleObject (readonly)

Returns the value of attribute title.



98
99
100
# File 'lib/lyrics/mediawikilyrics.rb', line 98

def title
  @title
end

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

Returns:

  • (Boolean)


122
123
124
# File 'lib/lyrics/mediawikilyrics.rb', line 122

def instrumental?()
	return @lyrics == nil
end