Class: FastStats::Means

Inherits:
Object
  • Object
show all
Defined in:
lib/fast_stats/means.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMeans

Returns a new instance of Means.



10
11
12
# File 'lib/fast_stats/means.rb', line 10

def initialize
  @means = {}
end

Instance Attribute Details

#meansObject (readonly)

Returns the value of attribute means.



8
9
10
# File 'lib/fast_stats/means.rb', line 8

def means
  @means
end

Instance Method Details

#add(name, val) ⇒ Object



14
15
16
# File 'lib/fast_stats/means.rb', line 14

def add(name, val)
  mean_for(name) << val
end

#summary(round: Mean::DEFAULT_ROUND) ⇒ Object



18
19
20
# File 'lib/fast_stats/means.rb', line 18

def summary(round: Mean::DEFAULT_ROUND)
  means.transform_values { |m| m.summary round: 2 }
end