Skip to content

Instantly share code, notes, and snippets.

@arthurnn
Last active December 24, 2015 02:59
Show Gist options
  • Save arthurnn/6734205 to your computer and use it in GitHub Desktop.
Save arthurnn/6734205 to your computer and use it in GitHub Desktop.
class Cursor
include Enumerable
def each
p "cursor #{Thread.current.object_id}"
yield(1)
yield(2)
end
end
p "main #{Thread.current.object_id}"
e = Cursor.new.to_enum
e.next
@arthurnn
Copy link
Author

MRI result:

"main 70247306709460"
"cursor 70247306709460"

JRuby result:

"main 2000"
"cursor 2002"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment