[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

getting method names

Shashank Date

11/28/2003 6:45:00 PM

How do I get the name of the missing method inside the missing_method
method?

class Foo
def missing_method(*args)
puts " <#{???}> method is not yet implemented"
# ^^^^^^ What should I put here?
end
end

f = Foo.new
f.boo # This should print "<boo> method is not yet implemented"

TIA,
-- shanko


2 Answers

Simon Strandgaard

11/28/2003 6:54:00 PM

0

On Fri, 28 Nov 2003 12:45:09 -0600, Shashank Date wrote:

> How do I get the name of the missing method inside the missing_method
> method?


server> ruby a.rb
:test
[]
server> expand -t2 a.rb
class Test
def method_missing(meth, *args)
p meth, args
end
end

Test.new.test
server>

--
Simon Strandgaard

Shashank Date

11/28/2003 8:23:00 PM

0


"Simon Strandgaard" <neoneye@adslhome.dk> wrote in message
> def method_missing(meth, *args)
^^^^
Ah! I should have known better ... (/me smack forehead !)

Sorry for the noise :-(