Method: LSystem::RulesEngine#apply_rules

Defined in:
lib/l_system/rules_engine.rb

#apply_rules(state) ⇒ Object

Apply the system’s rules to the given state and return the result.



122
123
124
125
126
127
# File 'lib/l_system/rules_engine.rb', line 122

def apply_rules( state )
	rules_hash = self.rules_as_hash
	return state.each_char.with_object( String.new(encoding: 'utf-8') ) do |char, new_state|
		new_state << rules_hash[ char ]
	end
end