Class: Phonology::Rule

Inherits:
Object
  • Object
show all
Defined in:
lib/phonology/rule.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Rule

Returns a new instance of Rule.



101
102
103
# File 'lib/phonology/rule.rb', line 101

def initialize(&block)
  @rule = block
end

Instance Attribute Details

#ruleObject (readonly)

Returns the value of attribute rule.



99
100
101
# File 'lib/phonology/rule.rb', line 99

def rule
  @rule
end

Instance Method Details

#apply(sounds) ⇒ Object



105
106
107
108
# File 'lib/phonology/rule.rb', line 105

def apply(sounds)
  dsl = RulesDSL.new(sounds)
  dsl.apply(&rule).flatten
end