Method: LSystem::RulesEngine#variables=
- Defined in:
- lib/l_system/rules_engine.rb
#variables=(new_values) ⇒ Object
Set the systems variables to new_values.
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/l_system/rules_engine.rb', line 50 def variables=( new_values ) @rules_as_hash = nil new_values = Set.new( new_values, &:to_s ) unless new_values.disjoint?( self.constants ) common_char = (new_values & self.constants).to_a.first raise ArgumentError, "%p is already included in the constant set" % [ common_char ] end @variables = new_values end |