Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Ruby
How can I know which method is called?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Robert Klemme, post: 4514198"] You can use #method for this: irb(main):001:0> class Foo; def foo()end; def bar() end end => nil irb(main):002:0> class Bar < Foo;def bar() end end => nil irb(main):003:0> Bar.new.method :foo => #<Method: Bar(Foo)#foo> irb(main):004:0> Bar.new.method :bar => #<Method: Bar#bar> singleton method: irb(main):005:0> obj = Bar.new => #<Bar:0x3c49d0> irb(main):006:0> def obj.foo() end => nil irb(main):007:0> obj.method :foo => #<Method: #<Bar:0x3c49d0>.foo> Kind regards robert [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Ruby
How can I know which method is called?
Top