Guest User

Untitled

a guest
Apr 19th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. def hash2locals(binding, hash)
  2. hash.each do |name, value|
  3. value = "ObjectSpace._id2ref(#{ value.object_id })"
  4. eval "#{ name } = #{ value }", binding
  5. end
  6. binding
  7. end
  8.  
  9. def foo(locals)
  10. hash2locals lambda {}, locals
  11. bar
  12. end
  13.  
  14. foo :bar => 12 #=> NameError: undefined local variable or method `bar' for main:Object
Add Comment
Please, Sign In to add comment