Class: Co2Filter::RatingSet

Inherits:
HashWrapper show all
Defined in:
lib/co2_filter/rating_set.rb

Instance Method Summary collapse

Methods inherited from HashWrapper

#initialize, #method_missing, #to_hash

Constructor Details

This class inherits a constructor from Co2Filter::HashWrapper

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Co2Filter::HashWrapper

Instance Method Details

#[]=(key, val) ⇒ Object



6
7
8
9
# File 'lib/co2_filter/rating_set.rb', line 6

def []=(key, val)
  super(key, val)
  @mean = nil
end

#meanObject



2
3
4
# File 'lib/co2_filter/rating_set.rb', line 2

def mean
  @mean ||= 1.0 * @data.values.inject(:+) / @data.size
end