Skip to content

Instantly share code, notes, and snippets.

@banister
Created March 19, 2013 22:26
Show Gist options
  • Save banister/5200704 to your computer and use it in GitHub Desktop.
Save banister/5200704 to your computer and use it in GitHub Desktop.
[1] pry(main)> class BasicObject
| define_method(:instance_variables, ::Kernel.instance_method(:instance_variables))
| end
=> #<UnboundMethod: Kernel#instance_variables>
[2] pry(main)> o = BasicObject.new
=> #<BasicObject:0x3fe8d94cb40c>
[3] pry(main)> o.instance_eval { @x = 10 }
=> 10
[4] pry(main)> o.instance_variables
=> [:@x]
[5] pry(main)> gist -i 1..4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment