class PlaylyfeClient::V2::CompoundMetric
Attributes
formula[R]
Public Class Methods
new(metric_hash, game)
click to toggle source
Calls superclass method
PlaylyfeClient::V2::Metric::new
# File lib/playlyfe_client/v2/metric/compound_metric.rb, line 23 def initialize(metric_hash, game) super(metric_hash, game) @formula=metric_hash[:formula] || metric_hash["formula"] end
Public Instance Methods
apply_reward(reward, scores)
click to toggle source
# 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