------art_256960_4902640.1165988820976
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

  1 class Book
  2 def method_missing(method_id,*params,&block)
  3 print 'original method missing'
  4 end
  5
  6 alias :original_method_missing :method_missing
  7 def method_missing(method_id,*params,&block)
  8 C(params[:comment])print 'my method missing'
  9 original_method_missing(method_id,*prams,&block)
 10 end
 11 end
 12
 13 book  ook.new
 14 book.tester

its looks like work , but output is
thod missingmy method missingmy method missingmy method missingmy method
missingmy method missingmy method missingmy method missingmy method
missingmy method missingmy method missingmy method missingmy method
missingmy method missingmy method missingmy method missingmy method
missingmy method missintest.rb:9:in `method_missing': stack level too deep
(SystemStackError)
        from test.rb:9:in `method_missing'
        from test.rb:14

any idia?

thank you for your help


On 12/13/06, Devin Mullins <twifkak / comcast.net> wrote:
>
> What Giles said, except:
>    when /new stuff/: #your code
>    else original_method_missing(*args,&blk)
> Probably makes more sense.
>
> Giles Bowkett wrote:
> > alias :original_method_missing :method_missing
> >
> > def method_missing(*args)
> >  case args
> >    when /normal stuff/
> >      original_method_missing(args)
> >    when /new stuff/
> >      # your code goes here
> >  end
> > end
> >
> > (please bear in mind this is just a sketch.)
> >
> >
> >
>
>
>

------art_256960_4902640.1165988820976--