Guest User

Untitled

a guest
Apr 19th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.19 KB | None | 0 0
  1. class ImplicitContext
  2. attr_accessor :i
  3. end
  4.  
  5. def r(&blk)
  6. Proc.new { |i|
  7. ctxt = ImplicitContext.new
  8. ctxt.i = i
  9. ctxt.instance_eval(&blk)
  10. }
  11. end
  12.  
  13. p [1, 2, 3].map(&r { 2*i })
Add Comment
Please, Sign In to add comment