Guest User

Untitled

a guest
Jan 22nd, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. module Kernel
  2. def future(&blk)
  3. raise ArgumentError, "no block supplied" unless blk
  4. o = BasicObject.new
  5. class << o
  6. def __initialize__(thr)
  7. @thread = thr
  8. return self
  9. end
  10. def method_missing(name, *args, &blk)
  11. @thread.value.send(name, *args, &blk)
  12. end
  13. end
  14. return o.__initialize__(Thread.start(&blk))
  15. end
  16. end
Add Comment
Please, Sign In to add comment