lib/lazy_object.rb in lazy_object-0.0.3 vs lib/lazy_object.rb in lazy_object-0.1.0
- old
+ new
@@ -8,23 +8,23 @@
#
# lazy = LazyObject.new { VeryExpensiveObject.new } # At this point the VeryExpensiveObject hasn't been initialized yet.
# lazy.get_expensive_results(foo, bar) # Initializes VeryExpensiveObject and calls 'get_expensive_results' on it, passing in foo and bar
class LazyObject < BasicObject
def self.version
- '0.0.3'
+ '0.1.0'
end
def initialize(&callable)
@__callable__ = callable
end
- def ==(item)
- __target_object__ == item
+ def ==(other)
+ __target_object__ == other
end
- def !=(item)
- __target_object__ != item
+ def !=(other)
+ __target_object__ != other
end
def !
!__target_object__
end
@@ -33,9 +33,9 @@
def __target_object__
@__target_object__ ||= @__callable__.call
end
# Forwards all method calls to the target object.
- def method_missing(method_name, *args, &block)
- __target_object__.send(method_name, *args, &block)
+ def method_missing(method_name, ...)
+ __target_object__.send(method_name, ...)
end
end