lib/elastic_engine/support/forwardable.rb
# Forwards specific method(s) to the provided receiver
#
# @example Forward the `each` method to `results` object
#
#   MyClass.forward(:results, :each)
#
# @example Forward the `include?` method to `ancestors` class method
#
#   MyClass.forward(:'self.ancestors', :include?)
#
# @param [ Symbol ] receiver        The name of the receiver method
# @param [ Symbol, Array ] methods  The forwarded methods
#
# @api private
#
Forwards specific method(s) to the provided receiver
Forwards specific method ( s ) to the provided receiver
def forward(receiver, *methods)
        methods = Array(methods).flatten
        target  = self.__send__ :eval, receiver.to_s rescue nil
        if target
          single_delegate   methods => receiver
        else
          instance_delegate methods => receiver
        end
      end
def forward ( receiver , * methods ) methods = Array ( methods ) . flatten target = self . __send__ :eval , receiver . to_s rescue nil if target single_delegate methods => receiver else instance_delegate methods => receiver end end
Forwards specific method(s) to the provided receiver
Forwards specific method ( s ) to the provided receiver
receiver
<not_specific>
methods
<not_specific>
<not_specific>
methods The forwarded methods
methods The forwarded methods
example
Forward the `each` method to `results` object MyClass.forward(:results, :each)
Forward the ` each ` method to ` results ` object MyClass . forward ( : results : each )
example
Forward the `include?` method to `ancestors` class method MyClass.forward(:'self.ancestors', :include?)
Forward the ` include? ` method to ` ancestors ` class method MyClass . forward ( : ' self . ancestors ' : include? )
api
None