Module: Axiom::Relation::Proxy

Included in:
Operation::Deletion, Operation::Insertion, Variable
Defined in:
lib/axiom/relation/proxy.rb

Overview

Allow relations to proxy to other relations

Constant Summary collapse

ENUMERABLE_METHODS =

Relation methods to proxy

Enumerable.public_instance_methods.map(&:to_s).freeze
PROXY_METHODS =
%w[header each empty? materialized?].freeze
RELATION_METHODS =
%w[take drop sort_by].freeze

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args, &block) ⇒ self, Object (private)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Forward the message to the relation

Parameters:

  • args (Array)

Returns:

  • (self)

    return self for all command methods

  • (Object)

    return response from all query methods



62
63
64
65
66
67
68
69
# File 'lib/axiom/relation/proxy.rb', line 62

def method_missing(*args, &block)
  response = relation.public_send(*args, &block)
  if response.equal?(relation)
    self
  else
    response
  end
end

Instance Method Details

#respond_to?(method) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Test if the method is supported on this object

Parameters:

  • method (Symbol)

Returns:

  • (Boolean)


46
47
48
# File 'lib/axiom/relation/proxy.rb', line 46

def respond_to?(method, *)
  super || forwardable?(method)
end