Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/plugin/filter_concat.rb

Instance Method Summary collapse

Instance Method Details

#sumObject



484
485
486
487
488
489
490
491
492
# File 'lib/fluent/plugin/filter_concat.rb', line 484

def sum
  inject(0) do |memo, value|
    if block_given?
      memo + yield(value)
    else
      memo + value
    end
  end
end