Class: Lyric

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#albumObject

Returns the value of attribute album.



3
4
5
# File 'lib/lyrics_ebook/lyric.rb', line 3

def album
  @album
end

#artistObject

Returns the value of attribute artist.



3
4
5
# File 'lib/lyrics_ebook/lyric.rb', line 3

def artist
  @artist
end

#mp3_filenameObject

Returns the value of attribute mp3_filename.



3
4
5
# File 'lib/lyrics_ebook/lyric.rb', line 3

def mp3_filename
  @mp3_filename
end

#titleObject

Returns the value of attribute title.



3
4
5
# File 'lib/lyrics_ebook/lyric.rb', line 3

def title
  @title
end

#tracknumObject

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_textObject



27
28
29
# File 'lib/lyrics_ebook/lyric.rb', line 27

def html_text
  @text.collect{|line| h(line)}.join("<br />")
end

#textObject



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_sObject



15
16
17
# File 'lib/lyrics_ebook/lyric.rb', line 15

def to_s
  "#{@artist} - #{@title}"
end