Skip to content

Instantly share code, notes, and snippets.

@fnando
Created June 8, 2011 23:12
Show Gist options
  • Save fnando/1015687 to your computer and use it in GitHub Desktop.
Save fnando/1015687 to your computer and use it in GitHub Desktop.
Switch block's context and yield variable. At the same time. How would you do it?
object = Object.new
block = proc do |var|
puts "var: #{var.inspect}" #=> should be :a => 1
puts "self: #{self.inspect}" #=> should be object variable
end
block.call :a => 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment