Module: Averager::ObjectExtensions
- Defined in:
- lib/averager.rb
Instance Method Summary collapse
Instance Method Details
#each_with_avg(options = {}) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/averager.rb', line 10 def each_with_avg( = {}) raise NoMethodError if !self.respond_to?(:each) [:expected] ||= self.count if self.respond_to?(:count) Averager.new() do |a| self.each do |element| yield(element) a.avg end end end |