Skip to content

Instantly share code, notes, and snippets.

@igrep
Created October 21, 2010 03:09
Show Gist options
  • Save igrep/637855 to your computer and use it in GitHub Desktop.
Save igrep/637855 to your computer and use it in GitHub Desktop.
dynamically defining each_with_object
module Enumerable
def each_with_object(memo, &block)
each do |element|
block.call(element, memo)
end
memo
end unless public_method_defined? :each_with_object
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment