Class: Kotodama::Change

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#changesObject (readonly)

Returns the value of attribute changes.



3
4
5
# File 'lib/change.rb', line 3

def changes
  @changes
end

#languageObject (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