Hi,
just a short question:
Is there a way to "ask" an object or class what methods are available
from it?
This is not meant to be used inside a program but just as a quick
check, what I can do with what.
Ruby.use!
Meino
Hi,
just a short question:
Is there a way to "ask" an object or class what methods are available
from it?
This is not meant to be used inside a program but just as a quick
check, what I can do with what.
Ruby.use!
Meino
In article <20040827.074607.71100747.Meino.Cramer@gmx.de>,
Hi,
just a short question:
Is there a way to "ask" an object or class what methods are available
from it?This is not meant to be used inside a program but just as a quick
check, what I can do with what.Ruby.use!
Meino
try:
instance_methods
methods
example:
irb(main):001:0> class Foo
irb(main):002:1> def foo
irb(main):003:2> "foo"
irb(main):004:2> end
irb(main):005:1> end
irb(main):010:0> Foo.instance_methods
=> ["clone", "display", "protected_methods", "freeze",
"instance_variable_set", "foo", "is_a?", "type", "methods", "method",
"=~", "send", "instance_of?", "__id__", "instance_variables", "to_s",
"eql?", "dup", "hash", "private_methods", "nil?", "tainted?", "class",
"singleton_methods", "extend", "instance_eval", "untaint", "__send__",
"instance_variable_get", "object_id", "kind_of?", "inspect", "taint",
"frozen?", "==", "public_methods", "id", "respond_to?", "===", "equal?",
"to_a"]
irb(main):011:0> f = Foo.new
=> #<Foo:0x884ac>
irb(main):012:0> f.methods
=> ["clone", "display", "protected_methods", "freeze",
"instance_variable_set", "foo", "is_a?", "type", "methods", "method",
"=~", "send", "instance_of?", "__id__", "instance_variables", "to_s",
"eql?", "dup", "hash", "private_methods", "nil?", "tainted?", "class",
"singleton_methods", "extend", "instance_eval", "untaint", "__send__",
"instance_variable_get", "object_id", "kind_of?", "inspect", "taint",
"frozen?", "==", "public_methods", "id", "respond_to?", "===", "equal?",
"to_a"]
Phil
Meino Christian Cramer <Meino.Cramer@gmx.de> wrote:
Hi Asaph, Hi Phil !
Thank you very much for your fast replies - that is exactly what I
have searched for !
Have a nice day !
Meino