From: ahoward Date: 2003-02-01T03:06:58+09:00 Subject: Re: Overriding methods in inherited classes On Fri, 31 Jan 2003, Travis Whitton wrote: > It looked promising, but it didn't work... eg/ruby > cat scgi.rb require 'cgi' class SCGI < CGI module QueryExtension def [](*args) if @params[*args] return @params[*args][0] end end end include QueryExtension end p SCGI.new['foo'] ~/eg/ruby > ruby -v ruby 1.8.0 (2003-01-30) [i686-linux] eg/ruby > ruby sgci.rb (offline mode: enter name=value pairs on standard input) foo=bar "bar" ~/eg/ruby > ruby -v ruby 1.6.7 (2002-03-01) [i686-linux] eg/ruby > ruby scgi.rb (offline mode: enter name=value pairs on standard input) foo=bar ["bar"] looks like the behavior of cgi[*args] changed from 1.6.8 to 1.8.0. you will have to work around this in 1.6.8. -a > > travis@travis travis $ cat scgitest.rb > require 'scgi' > s = SCGI.new > p s["foo"] > > travis@travis travis $ ruby scgitest.rb > (offline mode: enter name=value pairs on standard input) > foo=bar > ["bar"] > > -Travis > > -- ==================================== | Ara Howard | NOAA Forecast Systems Laboratory | Information and Technology Services | Data Systems Group | R/FST 325 Broadway | Boulder, CO 80305-3328 | Email: ahoward@fsl.noaa.gov | Phone: 303-497-7238 | Fax: 303-497-7259 ====================================