From: unbewusst.sein@... (=?ISO-8859-1?Q?Une_B=E9v?= =?ISO-8859-1?Q?ue?=) Date: 2007-03-25T19:00:04+09:00 Subject: Re: adding anotehr each method to String Harold Hausman wrote: > > irb(main):001:0> "a string".split( "" ) > => ["a", " ", "s", "t", "r", "i", "n", "g"] OK fine, then no need to extend String ))) > > > generally speaking how to list-out, for a given class all the methods ? > > > > irb(main):002:0> "a string".methods.sort => ["%", "*", "+", "<", "<<", > "<=", "<=>", "==", "===", "=~", ">", ">=", "[]", " []=", "__id__", > "__send__", "all?", "any?", "between?", "capitalize", "capitaliz e!", > "casecmp", "center", "chomp", "chomp!", "chop", "chop!", "class", "clone", > "collect", "concat", "count", "crypt", "delete", "delete!", "detect", > "display", "downcase", "downcase!", "dump", "dup", "each", "each_byte", > "each_line", "each _with_index", "empty?", "entries", "eql?", "equal?", > "extend", "find", "find_all ", "freeze", "frozen?", "gem", "grep", "gsub", > "gsub!", "hash", "hex", "id", "in clude?", "index", "inject", "insert", > "inspect", "instance_eval", "instance_of?" , "instance_variable_defined?", > "instance_variable_get", "instance_variable_set" , "instance_variables", > "intern", "is_a?", "is_binary_data?", "is_complex_yaml?" , "kind_of?", > "length", "ljust", "lstrip", "lstrip!", "map", "match", "max", "me mber?", > "method", "methods", "min", "next", "next!", "nil?", "object_id", "oct", > "partition", "private_methods", "protected_methods", "public_methods", > "reject" , "replace", "require", "require_gem", "respond_to?", "reverse", > "reverse!", "ri ndex", "rjust", "rstrip", "rstrip!", "scan", "select", > "send", "singleton_method s", "size", "slice", "slice!", "sort", > "sort_by", "split", "squeeze", "squeeze!" , "strip", "strip!", "sub", > "sub!", "succ", "succ!", "sum", "swapcase", "swapcas e!", "taguri", > "taguri=", "taint", "tainted?", "to_a", "to_f", "to_i", "to_s", " to_str", > "to_sym", "to_yaml", "to_yaml_properties", "to_yaml_style", "tr", "tr!" , > "tr_s", "tr_s!", "type", "unpack", "untaint", "upcase", "upcase!", "upto", > "zi > p"] > > ;) > > Hope that helps, Yes a lot, thanks again ! -- It's easy to play any musical instrument: all you have to do is touch the right key at the right time and the instrument will play itself. -- J.S. Bach