Sha256: dade527322e7202aa929e027cd9a5d2bd556ae9950433585cec98dfe06b22a77

Contents?: true

Size: 200 Bytes

Versions: 1

Compression:

Stored size: 200 Bytes

Contents

class Array
  def average(attr = nil)
    return nil if size == 0
    unless attr.nil?
      return collect(&:"#{attr}").reject(&:nil?).sum.to_f / size.to_f
    end
    sum.to_f / size.to_f
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
heartwood-0.0.1 lib/heartwood/support/array.rb