Class: Array

Inherits:
Object show all
Defined in:
lib/guerrilla_patch/kernel.rb

Overview

add sum_me to array, with or without name

Instance Method Summary collapse

Instance Method Details

#sum_me(name = nil) ⇒ Object



54
55
56
# File 'lib/guerrilla_patch/kernel.rb', line 54

def sum_me(name = nil)
  self.map(&name).reduce(0, :+)
end