Module: Botch::Delegator

Defined in:
lib/botch/main.rb

Class Method Summary collapse

Class Method Details

.delegate(*methods) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/botch/main.rb', line 6

def delegate(*methods)
  methods.each do |method_name|
    define_method(method_name) do |*args, &block|
      Delegator.target.send(method_name, *args, &block)
    end
  end
end

.targetObject



14
15
16
# File 'lib/botch/main.rb', line 14

def target
  @target ||= Main
end

.target=(klass) ⇒ Object



18
19
20
# File 'lib/botch/main.rb', line 18

def target=(klass)
  @target = klass
end