Skip to content

Instantly share code, notes, and snippets.

@sionide21
Created December 11, 2015 22:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sionide21/ef566174fbd083decec6 to your computer and use it in GitHub Desktop.
Save sionide21/ef566174fbd083decec6 to your computer and use it in GitHub Desktop.
Enumerable Weirdness
class Test
include Enumerable
def each
yield "Hello"
yield "World"
end
end
enum = Test.new
array = ["Hello", "World"]
enum.grep(/^(.)/) {$1} # => [nil, nil]
array.grep(/^(.)/) {$1} # => ["H", "W"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment