Module: EvoSynth::Evolvers::ProfileUsingEvolver
- Included in:
- Evolver
- Defined in:
- lib/evosynth/evolvers/profile_using_evolver.rb
Overview
This module provides the ability to use the Profile class in a evolver.
Instance Method Summary collapse
Instance Method Details
#init_profile(*properties) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/evosynth/evolvers/profile_using_evolver.rb', line 32 def init_profile(*properties) @properties = properties @properties.each do |property| if property.is_a?(Symbol) self.class.send(:attr_accessor, property) elsif property.is_a?(Hash) property.keys.each { |key| self.class.send(:attr_accessor, key) } else raise ArgumentError, "argument type not supported" end end end |
#use_profile(profile) ⇒ Object
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/evosynth/evolvers/profile_using_evolver.rb', line 45 def use_profile(profile) @profile = profile @properties.each do |property| if property.is_a? Symbol use_property(profile, property) elsif property.is_a? Hash use_property_hash(profile, property) end end end |