Class: Lyric
- Inherits:
-
Object
- Object
- Lyric
- Defined in:
- lib/lyrics_ebook/lyric.rb
Instance Attribute Summary collapse
-
#album ⇒ Object
Returns the value of attribute album.
-
#artist ⇒ Object
Returns the value of attribute artist.
-
#mp3_filename ⇒ Object
Returns the value of attribute mp3_filename.
-
#title ⇒ Object
Returns the value of attribute title.
-
#tracknum ⇒ Object
Returns the value of attribute tracknum.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #html_text ⇒ Object
-
#initialize(map = nil) ⇒ Lyric
constructor
A new instance of Lyric.
- #text ⇒ Object
- #text=(a) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(map = nil) ⇒ Lyric
Returns a new instance of Lyric.
5 6 7 8 9 |
# File 'lib/lyrics_ebook/lyric.rb', line 5 def initialize(map=nil) map.each do |k,v| send("#{k}=",v) end if map end |
Instance Attribute Details
#album ⇒ Object
Returns the value of attribute album.
3 4 5 |
# File 'lib/lyrics_ebook/lyric.rb', line 3 def album @album end |
#artist ⇒ Object
Returns the value of attribute artist.
3 4 5 |
# File 'lib/lyrics_ebook/lyric.rb', line 3 def artist @artist end |
#mp3_filename ⇒ Object
Returns the value of attribute mp3_filename.
3 4 5 |
# File 'lib/lyrics_ebook/lyric.rb', line 3 def mp3_filename @mp3_filename end |
#title ⇒ Object
Returns the value of attribute title.
3 4 5 |
# File 'lib/lyrics_ebook/lyric.rb', line 3 def title @title end |
#tracknum ⇒ Object
Returns the value of attribute tracknum.
3 4 5 |
# File 'lib/lyrics_ebook/lyric.rb', line 3 def tracknum @tracknum end |
Instance Method Details
#<=>(other) ⇒ Object
11 12 13 |
# File 'lib/lyrics_ebook/lyric.rb', line 11 def <=>(other) @title<=>other.title end |
#html_text ⇒ Object
27 28 29 |
# File 'lib/lyrics_ebook/lyric.rb', line 27 def html_text @text.collect{|line| h(line)}.join("<br />") end |
#text ⇒ Object
23 24 25 |
# File 'lib/lyrics_ebook/lyric.rb', line 23 def text @text.join if @text end |
#text=(a) ⇒ Object
19 20 21 |
# File 'lib/lyrics_ebook/lyric.rb', line 19 def text=(a) @text=a.to_a end |
#to_s ⇒ Object
15 16 17 |
# File 'lib/lyrics_ebook/lyric.rb', line 15 def to_s "#{@artist} - #{@title}" end |