Class: PlaylyfeClient::V2::CompoundMetric
- Defined in:
- lib/playlyfe_client/v2/metric/compound_metric.rb
Instance Attribute Summary collapse
-
#formula ⇒ Object
readonly
Returns the value of attribute formula.
Attributes inherited from Metric
#description, #id, #name, #type
Attributes inherited from Metric
Instance Method Summary collapse
Methods inherited from Metric
Instance Attribute Details
#formula ⇒ Object (readonly)
Returns the value of attribute formula.
6 7 8 |
# File 'lib/playlyfe_client/v2/metric/compound_metric.rb', line 6 def formula @formula end |
Instance Method Details
#apply_reward(reward, scores) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/playlyfe_client/v2/metric/compound_metric.rb', line 9 def apply_reward(reward, scores) metric_sym=self.id.to_sym case reward[:verb] when "add" scores[:compounds][metric_sym]+=reward[:value].to_i when "remove" scores[:compounds][metric_sym]-=reward[:value].to_i when "set" scores[:compounds][metric_sym]=reward[:value].to_i end end |