Method: Stan::Histogram#to_a
- Defined in:
- lib/stan/histogram.rb
#to_a ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/stan/histogram.rb', line 10 def to_a @list.each_with_object({}) do |item, hash| bin = if bin_size.to_f > 0 (item.to_f / bin_size).round * bin_size else item end hash[bin] = hash[bin].to_i + 1 end.sort end |