Class: Gly::Lyrics

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/gly/lyrics.rb

Instance Method Summary collapse

Constructor Details

#initializeLyrics

Returns a new instance of Lyrics.



7
8
9
# File 'lib/gly/lyrics.rb', line 7

def initialize
  @words = []
end

Instance Method Details

#each_syllableObject



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

#readableObject



28
29
30
# File 'lib/gly/lyrics.rb', line 28

def readable
  @words.collect(&:readable).join ' '
end