Class: Evolvable::Goal
- Inherits:
-
Object
- Object
- Evolvable::Goal
- Defined in:
- lib/evolvable/goal.rb
Overview
Custom Goals
You can create custom goals by subclassing Evolvable::Goal
and implementing:
evaluate(evolvable)
: Return a value that for sorting evolvablesmet?(evolvable)
: Returns true when the goal value is reached
Direct Known Subclasses
Instance Attribute Summary collapse
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #evaluate(_evolvable) ⇒ Object
-
#initialize(value: nil) ⇒ Goal
constructor
A new instance of Goal.
- #met?(_evolvable) ⇒ Boolean
Constructor Details
#initialize(value: nil) ⇒ Goal
Returns a new instance of Goal.
33 34 35 |
# File 'lib/evolvable/goal.rb', line 33 def initialize(value: nil) @value = value if value end |
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
37 38 39 |
# File 'lib/evolvable/goal.rb', line 37 def value @value end |
Instance Method Details
#evaluate(_evolvable) ⇒ Object
39 40 41 |
# File 'lib/evolvable/goal.rb', line 39 def evaluate(_evolvable) raise Error, "Undefined method: #{self.class.name}##{__method__}" end |
#met?(_evolvable) ⇒ Boolean
43 44 45 |
# File 'lib/evolvable/goal.rb', line 43 def met?(_evolvable) raise Error, "Undefined method: #{self.class.name}##{__method__}" end |