class TransparentProxy
Constants
- VERSION
Public Class Methods
new(object=nil, &block)
click to toggle source
# File lib/transparent_proxy.rb, line 36 def initialize(object=nil, &block) @lazy_object = block_given? ? block : object end
Public Instance Methods
inspect()
click to toggle source
# File lib/transparent_proxy.rb, line 14 def inspect __getobj__.inspect end
methods(*args)
click to toggle source
# File lib/transparent_proxy.rb, line 22 def methods(*args) proxy_methods(*args) | __getobj__.methods(*args) end
proxy?()
click to toggle source
# File lib/transparent_proxy.rb, line 30 def proxy? true end
proxy_inspect()
click to toggle source
# File lib/transparent_proxy.rb, line 18 def proxy_inspect "#<#{proxy_class} @object=#{inspect}>" end
respond_to?(*args)
click to toggle source
# File lib/transparent_proxy.rb, line 26 def respond_to?(*args) proxy_respond_to?(*args) || __getobj__.respond_to?(*args) end
Private Instance Methods
__getobj__()
click to toggle source
# File lib/transparent_proxy.rb, line 40 def __getobj__ @object ||= @lazy_object.is_a?(Proc) ? @lazy_object.call : @lazy_object end
method_missing(method, *args, &block)
click to toggle source
# File lib/transparent_proxy.rb, line 44 def method_missing(method, *args, &block) __getobj__.send(method, *args, &block) end