Class: Spanish::Syllable::Syllables

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/spanish/syllable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sounds) ⇒ Syllables

Returns a new instance of Syllables.



110
111
112
# File 'lib/spanish/syllable.rb', line 110

def initialize(sounds)
  @sounds = sounds
end

Instance Attribute Details

#indexObject (readonly)

Returns the value of attribute index.



108
109
110
# File 'lib/spanish/syllable.rb', line 108

def index
  @index
end

#soundsObject (readonly)

Returns the value of attribute sounds.



108
109
110
# File 'lib/spanish/syllable.rb', line 108

def sounds
  @sounds
end

Instance Method Details

#each(&block) ⇒ Object



114
115
116
117
118
119
120
121
122
# File 'lib/spanish/syllable.rb', line 114

def each(&block)
  begin
    sounds.each_index { |i| @index = i; append or do_yield(&block) }
    do_yield(&block)
  ensure
    @index = 0
    @syllable = nil
  end
end