So I did this:
>> String.methods.sort
=> ["<", "<=", "<=>", "==", "===", "=~", ">", ">=", "__id__",
"__send__", "allocate", "ancestors", "autoload", "autoload?", "class",
"class_eval", "class_variable_defined?", "class_variables", "clone",
"const_defined?", "const_get", "const_missing", "const_set",
"constants", "display", "dup", "eql?", "equal?", "extend", "freeze",
"frozen?", "hash", "id", "include?", "included_modules", "inspect",
"instance_eval", "instance_method", "instance_methods",
"instance_of?", "instance_variable_defined?", "instance_variable_get",
"instance_variable_set", "instance_variables", "is_a?", "kind_of?",
"method", "method_defined?", "methods", "module_eval", "name", "new",
"nil?", "object_id", "private_class_method",
"private_instance_methods", "private_method_defined?",
"private_methods", "protected_instance_methods",
"protected_method_defined?", "protected_methods",
"public_class_method", "public_instance_methods",
"public_method_defined?", "public_methods", "respond_to?", "send",
"singleton_methods", "superclass", "taguri", "taguri=", "taint",
"tainted?", "to_a", "to_s", "to_yaml", "to_yaml_properties",
"to_yaml_style", "type", "untaint", "yaml_as", "yaml_new",
"yaml_tag_class_name", "yaml_tag_read_class", "yaml_tag_subclasses?"]
>> String.methods - Object.methods
=> ["yaml_new"]
Why am I not seeing the other string records that I know String has,
as demonstrated by:
>> "foo"
=> "foo"
>> "foo".class
=> String
>> "foo".upcase
=> "FOO"
Puzzled,
Sarah
(Using the empty String here...)
>> ''.methods.grep /upcase/
=> ["upcase!", "upcase"]
ruby-1.8.7-p174 > Integer.methods
=> ["private_class_method", "inspect", "name", "tap", "clone",
"public_methods", "object_id", "__send__", "method_defined?",
"instance_variable_defined?", "equal?", "freeze", "extend", "send",
"const_defined?", "methods", "ancestors", "module_eval",
"instance_method", "hash", "autoload?", "dup", "to_enum",
"instance_methods", "public_method_defined?", "instance_variables",
"class_variable_defined?", "eql?", "constants", "instance_eval", "id",
"singleton_methods", "module_exec", "induced_from", "const_missing",
"taint", "instance_variable_get", "frozen?", "enum_for",
"private_method_defined?", "public_instance_methods", "display",
"instance_of?", "superclass", "method", "to_a", "included_modules",
"const_get", "instance_exec", "type", "<", "protected_methods", "<=>",
"class_eval", "==", "class_variables", ">", "===",
"instance_variable_set", "protected_instance_methods",
"protected_method_defined?", "respond_to?", "kind_of?", ">=",
"public_class_method", "to_s", "<=", "const_set", "allocate", "class",
"private_methods", "=~", "tainted?", "__id__", "class_exec",
"autoload", "untaint", "nil?", "private_instance_methods", "include?",
"is_a?"]
ruby-1.8.7-p174 > Integer.methods(false)
=> ["induced_from"]
And for bonus, you
have .public_methods, .private_methods, .protected_methods,
and .singleton_methods available too
Mike