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.



380
381
382
# File 'lib/mobb/base.rb', line 380

def target
  @target
end

Class Method Details

.delegate(*methods) ⇒ Object



365
366
367
368
369
370
371
372
373
# File 'lib/mobb/base.rb', line 365

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