class NRSER::MethodMissingForwarder

A very simple class that forwards all method calls to the block it was initialized with (via {#method_missing}).

Public Class Methods

new(&forwarder) click to toggle source

Instantiate a new `NRSER::MethodMissingForwarder` holding the forwarding block.

@param [Proc<(symbol:Symbol, *args, &block)>] forwarder

Block that will receive all calls to {#method_missing}.
# File lib/nrser/sugar/method_missing_forwarder.rb, line 27
def initialize &forwarder
  @forwarder = forwarder
end

Public Instance Methods

method_missing(symbol, *args, &block) click to toggle source

Forwards all params to the `@forwarder` proc.

@param [Symbol] symbol

The name of the method that was called.

@param [Array] args

Any parameters the missing method was called with.

@param [Proc?] block

The block the method was called with, if any.
# File lib/nrser/sugar/method_missing_forwarder.rb, line 46
def method_missing symbol, *args, &block
  @forwarder.call symbol, *args, &block
end