[Nitro] Facets Aspects problem
nyarly at gmail.com
nyarly at gmail.com
Thu Feb 1 17:49:17 EST 2007
In trying to reduce the amount of eval'd code in Og I ran across the
following fascinating snippet in facets/more/aspects.rb:
target.instance_method(m).arity.times { |i| args << "a#{i}" }
Which is fine, unless the method takes a variable number of arguments,
in which case, the advised version of the method suddenly takes no
arguments.
Can I suggest:
arity = target.instance_method(m).arity
if arity < 0
(-(arity + 1).times{ |i| args << "a#{i}" }
args << "*argv"
else
arity.times { |i| args << "a#{i}" }
end
Working on a workaround...
More information about the Nitro-general
mailing list