Module: Mobb::Delegator

Defined in:
lib/mobb/base.rb

Overview

:nodoc:

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.targetObject

Returns the value of attribute target.



421
422
423
# File 'lib/mobb/base.rb', line 421

def target
  @target
end

Class Method Details

.delegate(*methods) ⇒ Object



406
407
408
409
410
411
412
413
414
# File 'lib/mobb/base.rb', line 406

def self.delegate(*methods)
  methods.each do |method_name|
    define_method(method_name) do |*args, &block|
      return super(*args, &block) if respond_to? method_name
      Delegator.target.send(method_name, *args, &block)
    end
    private method_name
  end
end