Class: Gly::Lyrics
Instance Method Summary collapse
- #each_syllable ⇒ Object
-
#initialize ⇒ Lyrics
constructor
A new instance of Lyrics.
- #readable ⇒ Object
Constructor Details
#initialize ⇒ Lyrics
Returns a new instance of Lyrics.
7 8 9 |
# File 'lib/gly/lyrics.rb', line 7 def initialize @words = [] end |
Instance Method Details
#each_syllable ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/gly/lyrics.rb', line 11 def each_syllable return enum_for(:each_syllable) unless block_given? @words.each_with_index do |w,wi| w.each_syllable.each do |s| yield s end if (wi + 1) < @words.size yield ' ' end end end |
#readable ⇒ Object
28 29 30 |
# File 'lib/gly/lyrics.rb', line 28 def readable @words.collect(&:readable).join ' ' end |