Class: Eco::Language::Delegation::ChainableDelegator

Inherits:
SimpleDelegator
  • Object
show all
Includes:
ForDelegator::ConstDelegator, ForDelegator::ConstLookupHooks, ForDelegator::DelegatedClass
Defined in:
lib/eco/language/delegation/chainable_delegator.rb

Instance Method Summary collapse

Methods included from ForDelegator::DelegatedClass

#delegated_class, #instance_of?, #is_a?, #new, #of_kind?

Constructor Details

#initialize(*args, **kargs, &block) ⇒ ChainableDelegator

Note:

it also allows to create an instance of delegated_class on initialization.

It allows to chain delegators, when the first parameter is an instance of delegated_class.



11
12
13
14
15
16
# File 'lib/eco/language/delegation/chainable_delegator.rb', line 11

def initialize(*args, **kargs, &block)
  obj = args.first
  obj = new(*args, **kargs, &block) unless of_kind?(obj)

  super(obj)
end