Skip to content

Instantly share code, notes, and snippets.

@kaiwren
Created July 31, 2010 07:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaiwren/501905 to your computer and use it in GitHub Desktop.
Save kaiwren/501905 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'rspec'
describe 'Int with scope' do
class Ooga
def initialize
@bar = 'woot'
end
def foo
123.bar{ binding }
end
end
Integer.class_eval do
def bar
eval("@bar", yield)
end
end
it "should do scary stuff" do
Ooga.new.foo.should == 'woot'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment