Skip to content

Instantly share code, notes, and snippets.

@bluekeys
Created June 8, 2013 21:31
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 bluekeys/5736685 to your computer and use it in GitHub Desktop.
Save bluekeys/5736685 to your computer and use it in GitHub Desktop.
Trying to access local variables of a block
class Scraper
def scrape!(&block)
instance_eval &block
b = block.binding
eval("p local_variables", b)
end
end
s = Scraper.new
s.scrape! do
variable = "some_value"
end
@bluekeys
Copy link
Author

bluekeys commented Jun 8, 2013

This doesn't work, but it indicates what I would like to see.

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