Method: Module#delegate
- Defined in:
- lib/famili/delegate.rb
#delegate(*method_names) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/famili/delegate.rb', line 2 def delegate(*method_names) opts = method_names.pop declarations = '' to = opts[:to] method_names.each do |name| declarations << <<-RUBY def #{name}(*args, &block) #{to}.#{name}(*args, &block) end RUBY end module_eval declarations end |