Class: MiniLyricsParser
- Inherits:
-
Object
- Object
- MiniLyricsParser
- Defined in:
- lib/lyrics_ebook/mini_lyrics_parser.rb
Instance Method Summary collapse
Instance Method Details
#parse(filename) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/lyrics_ebook/mini_lyrics_parser.rb', line 5 def parse filename return if File.directory?(filename) lyric=Lyric.new basename=File.basename(filename, File.extname(filename)) lyric.artist,lyric.title=basename.split(" - ") text_a=[] IO.foreach(filename) do |line| cl=clear(line).strip text_a << h(cl) if cl.size>0 end lyric.text=text_a.join("<br />\n") lyric end |