From: Simon Strandgaard Date: 2003-11-17T10:22:38+09:00 Subject: Re: overload method in module_eval, how? On Mon, 10 Nov 2003 15:48:22 +0100, ts wrote: >>>>>> "S" == Simon Strandgaard writes: > > S> any ideas to what can cause such a problem ? > > S> args.each{|method| > S> name = method.id2name > S> org = "_debug_"+name > S> arguments = (method.arity > 0) ? "(*a,&b)" : "(&b)" > > svg% ruby -e 'def test_x() end; :test_x.arity' > -e:1: undefined method `arity' for :test_x:Symbol (NoMethodError) > svg% > > svg% ruby -e 'def test_x() end; p method(:test_x).arity' > 0 > svg% > > and you can have an arity < 0 changing so it becomes (arity != 0), will that be ok? Still only the first output statement are working. I don't understand why the successive print-statements doesn't output anything. Any hints ? -- Simon Strandgaard server> ruby test_dbg.rb ["test_x"] Loaded suite test_dbg Started .. Finished in 0.003568 seconds. 1 tests, 1 assertions, 0 failures, 0 errors server> expand -t2 test_dbg.rb require 'test/unit' class Object def self.debug(*args) p instance_methods(false) args.each{|m| name = m.id2name org = "_debug_"+name n = method(m).arity puts "method=#{name} arity=#{n}" # No output, why ? arguments = (n != 0) ? "(*a,&b)" : "(&b)" code=<