From: Ibraheem Ibz Umaru-Mohammed Date: 2002-10-21T19:30:20+09:00 Subject: Re: string[lastchar] -> string? * "Pe?a, Botp" [2002-10-21 08:12]: > > > Ibraheem Ibz Umaru-Mohammed [mailto:iumarumo@btinternet.com] informs: > > ... > > I usually just fire up the interpreter, and do something like: > > > > ibz@ignoramus:$ irb > > Reading config file... done. > > ruby-1.7.3 on i686-pc-linux with irb 0.9(02/07/03) > > Type 'help' for more information. > > >>> String.methods.sort > > ["<", "<=", "<=>", "==", "===", "=~", ">", ">=", "__id__", > > "__send__", "allocate", "ancestors", "become", "class", > > "class_eval", "class_variables", "clone", "const_defined?", > > "const_get", "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_variables", "is_a?", "kind_of?", > > "method", "method_defined?", "methods", "module_eval", > > "name", "new", "nil?", "private_class_method", > > "private_instance_methods", "private_methods", > > "protected_instance_methods", "protected_methods", > > "public_class_method", "public_instance_methods", > > "public_methods", "respond_to?", "send", "singleton_methods", > > "superclass", "taint", "tainted?", "to_a", "to_s", "type", "untaint"] [--- snip ---] > Hi Ibraheem, > > I tried String.methods[40] n and got "to_a". > That magic number "40" seems a little strange to me. In the example above, I used String.methods.sort, just to get a sorted listing of the methods for "String". "ri" does a sorted listing, similar to the above, which can be invoked from the command-line. > Is it possible to do String.methods[40].man (or something like that) so that > it will output a manual-like page whose output is similar to ri's > String.methods.to_a ? > No. But then again, am not sure what you are after here. Are you trying to get "ri"-like output from within the interpreter? > many thanks -botp > --ibz. --