module ROM::Proxy

Public Class Methods

included(descendant) click to toggle source
Calls superclass method
# File lib/rom/support/proxy.rb, line 7
def self.included(descendant)
  descendant.send :undef_method, *descendant.superclass.public_instance_methods(false).map(&:to_s)
  descendant.extend(Constructor)
  super
end

Private Instance Methods

forward(*args, &block) click to toggle source
# File lib/rom/support/proxy.rb, line 36
def forward(*args, &block)
  response = @__decorated_object.public_send(*args, &block)

  if response.equal?(@__decorated_object)
    self
  elsif response.kind_of?(@__decorated_class)
    self.class.new(response, *@__args)
  else
    response
  end
end
forwardable?(method) click to toggle source
# File lib/rom/support/proxy.rb, line 32
def forwardable?(method)
  @__decorated_object.respond_to?(method)
end
method_missing(method, *args, &block) click to toggle source
Calls superclass method
# File lib/rom/support/proxy.rb, line 28
def method_missing(method, *args, &block)
  forwardable?(method) ? forward(method, *args, &block) : super
end