From: Tim Hunter Date: 2007-12-20T09:27:40+09:00 Subject: Re: slicing in ruby Robert Citek wrote: > Found it: indices, which is deprecated in favor of values_at. > > $ echo $(seq 1 10) | tee /dev/stderr | ruby -lane 'print > $F.values_at(1,2,3,8,2,2).join(" -- ") ' > 1 2 3 4 5 6 7 8 9 10 > 2 -- 3 -- 4 -- 9 -- 3 -- 3 > > Discovered this with a brute-force search: > > ruby -e 'puts [].methods.sort' | > while read name ; do > echo == $name > ri Array."${name}" | cat > done > > Interestingly, a lot of methods didn't return anything via ri. For example: > > $ ri Array.methods > Nothing known about Array.methods > > Anyone have any suggestions on a "cleaner" way to discover methods and > their docs? > The first two things that come to mind are: www.ruby-doc.org, if you want online doc, or one of the many fine books about Ruby if you want dead-tree doc. -- RMagick: http://rmagick.rubyforge.org/