getting method names

S

Shashank Date

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
 
S

Simon Strandgaard

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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top