Class: Array
Overview
add sum to array, with or without name
Instance Method Summary collapse
Instance Method Details
#sum(name = nil) ⇒ Object
50 51 52 |
# File 'lib/guerrilla_patch/kernel.rb', line 50 def sum(name = nil) self.map(&name).reduce(0, :+) end |