module Axiom::Relation::Proxy

Allow relations to proxy to other relations

Constants

ENUMERABLE_METHODS
PROXY_METHODS
RELATION_METHODS
REMOVE_METHODS

Attributes

relation[R]

The relation that is proxied to

@return [Relation]

@api private

Private Class Methods

included(descendant) click to toggle source

Hook called when module is included

@param [Module] descendant

the module or class including RelationProxy

@return [undefined]

@api private

Calls superclass method
# File lib/axiom/relation/proxy.rb, line 23
def self.included(descendant)
  super
  descendant.class_eval { undef_method(*REMOVE_METHODS) }
end

Public Instance Methods

respond_to?(method, *) click to toggle source

Test if the method is supported on this object

@param [Symbol] method

@return [Boolean]

@api private

Calls superclass method
# File lib/axiom/relation/proxy.rb, line 45
def respond_to?(method, *)
  super || forwardable?(method)
end

Private Instance Methods

forwardable?(method) click to toggle source

Test if the method can be forwarded to the relation

@param [Symbol] method

@return [Boolean]

@api private

# File lib/axiom/relation/proxy.rb, line 77
def forwardable?(method)
  relation.respond_to?(method)
end
method_missing(*args, &block) click to toggle source

Forward the message to the relation

@param [Array] args

@return [self]

return self for all command methods

@return [Object]

return response from all query methods

@api private

# File lib/axiom/relation/proxy.rb, line 61
def method_missing(*args, &block)
  response = relation.public_send(*args, &block)
  if response.equal?(relation)
    self
  else
    response
  end
end