Class: StatisticsHelper::Statistics
- Inherits:
-
Object
- Object
- StatisticsHelper::Statistics
- Defined in:
- lib/helpers/statistics.rb
Instance Method Summary collapse
- #+(statistics) ⇒ Object
- #<<(statistic) ⇒ Object
- #add(statistic) ⇒ Object
- #count ⇒ Object
- #data ⇒ Object
-
#initialize ⇒ Statistics
constructor
A new instance of Statistics.
- #mean ⇒ Object (also: #average, #avg)
Constructor Details
#initialize ⇒ Statistics
Returns a new instance of Statistics.
17 18 19 |
# File 'lib/helpers/statistics.rb', line 17 def initialize @statistics = Series.new end |
Instance Method Details
#+(statistics) ⇒ Object
37 38 39 |
# File 'lib/helpers/statistics.rb', line 37 def +(statistics) @statistics + statistics.data end |
#<<(statistic) ⇒ Object
33 34 35 |
# File 'lib/helpers/statistics.rb', line 33 def <<(statistic) add(statistic) end |
#add(statistic) ⇒ Object
21 22 23 |
# File 'lib/helpers/statistics.rb', line 21 def add(statistic) @statistics << statistic end |
#count ⇒ Object
25 26 27 |
# File 'lib/helpers/statistics.rb', line 25 def count @statistics.count end |
#data ⇒ Object
41 42 43 |
# File 'lib/helpers/statistics.rb', line 41 def data @statistics end |
#mean ⇒ Object Also known as: average, avg
29 30 31 |
# File 'lib/helpers/statistics.rb', line 29 def mean @statistics.mean end |