Method: Enumerable#product_by
- Defined in:
- lib/nose/util.rb
#product_by(initial = 1) ⇒ Object
Take the product of the result of calling the block on each item
42 43 44 |
# File 'lib/nose/util.rb', line 42 def product_by(initial = 1) reduce(initial) { |product, item| product * yield(item) } end |