71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
# File 'lib/flex/utils.rb', line 71
def define_delegation(opts)
file, line = caller.first.split(':', 2)
line = line.to_i
obj, meth, methods, to = opts[:in], opts[:by], opts[:for], opts[:to]
methods.each do |method|
obj.send meth, " def \#{method}(*args, &block) # def method_name(*args, &block)\n if \#{to} || \#{to}.respond_to?(:\#{method}) # if client || client.respond_to?(:name)\n \#{to}.__send__(:\#{method}, *args, &block) # client.__send__(:name, *args, &block)\n end # end\n end # end\n method\n end\n\nend\n", file, line - 1
|