Class: Rule

Inherits:
Object show all
Defined in:
lib/scoring_rules/rule.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#pointsObject

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