Module: Tins::MethodMissingDelegator

Included in:
DelegatorModule
Defined in:
lib/tins/dslkit.rb

Overview

This module contains a configurable method missing delegator and can be mixed into a module/class.

Defined Under Namespace

Modules: DelegatorModule Classes: DelegatorClass

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(id, *a, &b) ⇒ Object

Delegates all missing method calls to method_missing_delegator if this attribute has been set. Otherwise it will call super.



503
504
505
506
507
508
509
# File 'lib/tins/dslkit.rb', line 503

def method_missing(id, *a, &b)
  unless method_missing_delegator.nil?
    method_missing_delegator.__send__(id, *a, &b)
  else
    super
  end
end

Instance Attribute Details

#method_missing_delegatorObject

This object will be the receiver of all missing method calls, if it has a value other than nil.



499
500
501
# File 'lib/tins/dslkit.rb', line 499

def method_missing_delegator
  @method_missing_delegator
end