exercism/ruby/accumulate/accumulate.rb

14 lines
201 B
Ruby
Raw Permalink Normal View History

2018-03-05 07:08:48 +00:00
class Array
def accumulate(&block)
if block_given?
each_with_object([]) {|elem, out| out << yield(elem)}
else
self.to_enum
end
end
end
module BookKeeping
VERSION = 1
end