Forum: Ruby on Rails Find all the methods on a object in an irb session?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Bothari (Guest)
on 2006-03-12 23:19
(Received via mailing list)
How can I find all the methods on an object from withing irb?

Michael S. (Guest)
on 2006-03-12 23:34
(Received via mailing list)
Have you tried the "methods" method?  E.g.:

irb(main):001:0> x = "test"
=> "test"
irb(main):002:0> x.methods
=> ["send", "%", "rindex", "between?", "reject", "[]=", "split", "<<",
d", "strip", "size", "singleton_methods", "downcase", "gsub!", "count",
 "__send__", "downcase!", "intern", "member?", "squeeze!", "equal?",
"taint", "*
", "next", "find", "frozen?", "instance_variable_get",
p!", "each_line", "+", "kind_of?", "sub", "slice!", "instance_eval",
"to_a", "tr", "replace", "collect", "reverse", "all?", "type",
p", "protected_methods", "capitalize", "chop!", "extend", "capitalize!",
 "to_sym", "detect", "eql?", "instance_variable_set", "zip",
", "casecmp", "hash", "gsub", "empty?", "to_str", "map", "to_s", "tr_s",
 "tr!", "class", "match", "sort", "rstrip", "tainted?",
!", "swapcase", "min", "chomp!", "require_gem_with_options",
", "untaint", "find_all", "upto", "hex", "each", "sum", "id",
, "to_i", "insert", "<", "inject", "<=>", "inspect", "delete", "dump",
_s!", "unpack", ">", "concat", "===", "clone", "succ", "sort_by",
s", "strip!", "max", "rjust", ">=", "respond_to?", "display", "freeze",
 "select", "<=", "slice", "oct", "__id__", "to_f", "length", "chomp",
 "upcase", "partition", "=~", "sub!", "squeeze", "require_gem",
e!", "crypt", "delete!", "nil?", "dup", "grep", "instance_variables",
 "include?", "instance_of?", "center", "[]"]
Carl-Johan K. (Guest)
on 2006-03-12 23:34
(Received via mailing list)
Just call the method "methods" on the object, i.e:

This topic is locked and can not be replied to.