lib/lazyeval.rb in lazyeval-0.0.3 vs lib/lazyeval.rb in lazyeval-0.0.4

- old
+ new

@@ -1,28 +1,3 @@ -class Object - def lazy(&block) - Lazy.new(self, &block) - end -end - -class Lazy < (::RUBY_VERSION < '1.9') ? Object : BasicObject - undef_method(*(instance_methods - %w/__id__ __send__ respond_to? debugger/)) if ::RUBY_VERSION < '1.9' - - def initialize(obj, &block) - @obj, @block = obj, block - @args = @done = nil - end - - def method_missing(*args, &block) - unless @done - if !@args && !@block - @args, @block = args, @block - return self - end - - @res = @args ? @obj.send(*@args, &@block) : @block.call(@obj) - @done = true - end - - @res.send(*args, &block) - end -end +require 'lazyeval/version' +require 'lazyeval/lazy' +require 'lazyeval/object'