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.



523
524
525
526
527
528
529
# File 'lib/tins/dslkit.rb', line 523

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.



519
520
521
# File 'lib/tins/dslkit.rb', line 519

def method_missing_delegator
  @method_missing_delegator
end