Class: Shades::StreamBin
- Inherits:
-
Object
- Object
- Shades::StreamBin
- Defined in:
- lib/shades/histo.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
Returns the value of attribute count.
-
#sum ⇒ Object
Returns the value of attribute sum.
Instance Method Summary collapse
-
#initialize(count, sum) ⇒ StreamBin
constructor
A new instance of StreamBin.
- #mean ⇒ Object
- #merge(sb) ⇒ Object
Constructor Details
#initialize(count, sum) ⇒ StreamBin
Returns a new instance of StreamBin.
122 123 124 125 |
# File 'lib/shades/histo.rb', line 122 def initialize(count, sum) @count = count @sum = sum end |
Instance Attribute Details
#count ⇒ Object
Returns the value of attribute count.
119 120 121 |
# File 'lib/shades/histo.rb', line 119 def count @count end |
#sum ⇒ Object
Returns the value of attribute sum.
120 121 122 |
# File 'lib/shades/histo.rb', line 120 def sum @sum end |
Instance Method Details
#mean ⇒ Object
132 133 134 |
# File 'lib/shades/histo.rb', line 132 def mean Float(@sum) / Float(@count) end |
#merge(sb) ⇒ Object
127 128 129 130 |
# File 'lib/shades/histo.rb', line 127 def merge(sb) @count += sb.count @sum += sb.sum end |