[Nitro] Problem with aspects (in Facets).

nyarly at gmail.com nyarly at gmail.com
Mon Feb 5 14:34:59 EST 2007

Tom and I actually had a back and forth about this.  The dependency
slipped my mind:

The only addendum to make to that fix is:

def #{m}(*args, &block)
   #{gen_advice_code(m, target.advices, :pre)}
   __unwrapped_#{m}(*args, &block)

On Feb 5, 11:08 am, "George Moschovitis"
<george.moschovi... at gmail.com> wrote:
> While trying to make the no-eval sql.rb patch to work I found out that
> Aspects#wrap did not work as expected (at least for methods with default
> parameters, due to the way that airty works in Ruby). Here is a fix:
>   def self.wrap(target, methods = target.instance_methods)
>     include_advice_modules(target)
>     for m in [methods].flatten
>       target.module_eval <<-end_eval, __FILE__, __LINE__
>         alias_method :__unwrapped_#{m}, :#{m}
>         def #{m}(*args)
>           #{gen_advice_code(m, target.advices, :pre)}
>           __unwrapped_#{m}(*args)
>           #{gen_advice_code(m, target.advices, :post)}
>         end
>       end_eval
>     end
>   end
> this seems to work... But, I would like to ask Tom to have a look at the
> Aspects implementation and perhaps work his magic on a better solution.
> In the meantime please include this fix in facets/more/aspects.rb
> -g.
> --http://blog.gmosx.comhttp://cull.grhttp://www.joy.grhttp://nitroproject.org
> _______________________________________________
> Nitro-general mailing list
> Nitro-gene... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/nitro-general

More information about the Nitro-general mailing list