Class: Kotodama::Change
- Inherits:
-
Object
- Object
- Kotodama::Change
- Defined in:
- lib/change.rb
Instance Attribute Summary collapse
-
#changes ⇒ Object
readonly
Returns the value of attribute changes.
-
#language ⇒ Object
readonly
Returns the value of attribute language.
Instance Method Summary collapse
- #add(change) ⇒ Object
- #apply(language, word) ⇒ Object
-
#initialize(language) ⇒ Change
constructor
A new instance of Change.
Constructor Details
#initialize(language) ⇒ Change
Returns a new instance of Change.
5 6 7 8 |
# File 'lib/change.rb', line 5 def initialize language @language = language @changes = [] end |
Instance Attribute Details
#changes ⇒ Object (readonly)
Returns the value of attribute changes.
3 4 5 |
# File 'lib/change.rb', line 3 def changes @changes end |
#language ⇒ Object (readonly)
Returns the value of attribute language.
3 4 5 |
# File 'lib/change.rb', line 3 def language @language end |
Instance Method Details
#add(change) ⇒ Object
10 11 12 |
# File 'lib/change.rb', line 10 def add change @changes << change end |
#apply(language, word) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/change.rb', line 14 def apply language, word @changes.each do |change| word = apply_change word, change end word end |