From: "Ara.T.Howard" Date: 2004-03-15T01:24:35+09:00 Subject: Re: Kernel#y On Sun, 14 Mar 2004, daz wrote: > > Ara.T.Howard wrote: > > On Sun, 14 Mar 2004, Joel VanderWerf wrote: > > > > > > > > Two suggestions for Kernel#y: > > > > > > 1. Make it private, like Kernel#p. > > > > > > 2. Let it take multiple args, like Kernel#p, something like: > > > > > > irb> y 1,2,3 > > > --- 1 > > > --- 2 > > > --- 3 > > > => nil > > > > > > Anyone see any sense in these? > > > > > > I could add > > > > > > 3. Tell everyone about it because it's very useful :-) > > > > do tell. 'y' for yaml? > > > > # Create a bunch of stuff: > ahash = {:a => 1, 'BB' => 2, 7 => 'seven', 'd' => 10} > astring = RUBY_VERSION + ' ' + RELEASE_DATE > afloat = Math::PI > anarray = ['c', 111, Exception.new('Oops')] > > # Bunch it more: > anarray.push(ahash).push(astring).push(afloat) > > p anarray # for comparison > puts '.'*107, '' > > # See what yaml's y shows > require 'yaml' # <-------------------------# > y anarray wow. very, very cool. definitely should be changed to def y(*args) args.each{|a| super a} end though. -a -- =============================================================================== | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov | PHONE :: 303.497.6469 | ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328 | URL :: http://www.ngdc.noaa.gov/stp/ | TRY :: for l in ruby perl;do $l -e "print \"\x3a\x2d\x29\x0a\"";done ===============================================================================