Class: Scorecard::Rules
- Inherits:
-
Object
- Object
- Scorecard::Rules
- Defined in:
- lib/scorecard/rules.rb
Instance Attribute Summary collapse
-
#point_rules ⇒ Object
readonly
Returns the value of attribute point_rules.
Instance Method Summary collapse
- #add(context, amount, options = {}) ⇒ Object
- #clear ⇒ Object
- #find(context) ⇒ Object
-
#initialize ⇒ Rules
constructor
A new instance of Rules.
Constructor Details
#initialize ⇒ Rules
Returns a new instance of Rules.
4 5 6 |
# File 'lib/scorecard/rules.rb', line 4 def initialize @point_rules = [] end |
Instance Attribute Details
#point_rules ⇒ Object (readonly)
Returns the value of attribute point_rules.
2 3 4 |
# File 'lib/scorecard/rules.rb', line 2 def point_rules @point_rules end |
Instance Method Details
#add(context, amount, options = {}) ⇒ Object
8 9 10 |
# File 'lib/scorecard/rules.rb', line 8 def add(context, amount, = {}) point_rules << Scorecard::PointRule.new(context, amount, ) end |
#clear ⇒ Object
16 17 18 |
# File 'lib/scorecard/rules.rb', line 16 def clear point_rules.clear end |
#find(context) ⇒ Object
12 13 14 |
# File 'lib/scorecard/rules.rb', line 12 def find(context) point_rules.detect { |rule| rule.context == context } end |