Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Give a block to be evaluated lazily.
- class DelayedResult < BasicObject
- def initialize(&block)
- @block = block
- end
- def method_missing(m, *a, &b)
- @obj = @block.call() unless defined? @obj
- @obj.__send__(m, *a, &b)
- end
- end
Add Comment
Please, Sign In to add comment