Class: Module

Inherits:
Object show all
Defined in:
lib/picky/extensions/module.rb

Overview

The original Module class.

Instance Method Summary collapse

Instance Method Details

#each_forward(*methods) ⇒ Object



11
12
13
14
15
# File 'lib/picky/extensions/module.rb', line 11

def each_forward *methods
  forwarding methods,
    'def %{method}(*args, &block); %{to}.each{ |t| t.__send__(:%{method}, *args, &block) }; end',
    'Multi forwarding needs a target. Supply an options hash with a :to key as the last argument (e.g. each_forward :something, :to => :an_array_reader).'
end

#forward(*methods) ⇒ Object



5
6
7
8
9
# File 'lib/picky/extensions/module.rb', line 5

def forward *methods
  forwarding methods,
    'def %{method}(*args, &block); %{to}.__send__(:%{method}, *args, &block); end',
    'Forwarding needs a target. Supply an options hash with a :to key as the last argument (e.g. forward :something, :to => :a_reader).'
end