Module: Hknife::Delegator

Defined in:
lib/hknife.rb

Overview

:nodoc:

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.targetObject

Returns the value of attribute target.



256
257
258
# File 'lib/hknife.rb', line 256

def target
  @target
end

Class Method Details

.delegate(*methods) ⇒ Object



243
244
245
246
247
248
249
250
251
# File 'lib/hknife.rb', line 243

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