Class: Rule
Instance Attribute Summary collapse
-
#points ⇒ Object
Returns the value of attribute points.
Instance Method Summary collapse
- #evaluate(instance) ⇒ Object
-
#initialize(points, condition) ⇒ Rule
constructor
A new instance of Rule.
Constructor Details
#initialize(points, condition) ⇒ Rule
Returns a new instance of Rule.
4 5 6 7 |
# File 'lib/scoring_rules/rule.rb', line 4 def initialize(points, condition) @points = points @condition = condition end |
Instance Attribute Details
#points ⇒ Object
Returns the value of attribute points.
2 3 4 |
# File 'lib/scoring_rules/rule.rb', line 2 def points @points end |
Instance Method Details
#evaluate(instance) ⇒ Object
9 10 11 |
# File 'lib/scoring_rules/rule.rb', line 9 def evaluate(instance) @condition.evaluate(instance) * @points end |