diff options
| author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-04-22 08:18:19 +0000 |
|---|---|---|
| committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-04-22 08:18:19 +0000 |
| commit | 936bc711cec28cc336fccede492d7ede26aa4c71 (patch) | |
| tree | ac0bd072f77833edcba8d46083d4139e513d7595 /lib | |
| parent | f9dda551f865a39d0fba16dbd99fdeee73fe915c (diff) | |
| download | ruby-936bc711cec28cc336fccede492d7ede26aa4c71.tar.gz ruby-936bc711cec28cc336fccede492d7ede26aa4c71.tar.xz ruby-936bc711cec28cc336fccede492d7ede26aa4c71.zip | |
* parse.y (arg_ambiguous): hopefully better message.
* lib/cgi.rb (CGI::QueryExtension::initialize_query): to_ary
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3711 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/cgi.rb | 20 | ||||
| -rw-r--r-- | lib/rational.rb | 4 |
2 files changed, 11 insertions, 13 deletions
diff --git a/lib/cgi.rb b/lib/cgi.rb index 2e18bfd20..7dffdd9a3 100644 --- a/lib/cgi.rb +++ b/lib/cgi.rb @@ -941,27 +941,23 @@ convert string charset, and set language to "ja". end private :initialize_query - def [](key) - value, = @params[key] - unless value.nil? - value = value.dup - def value.to_ary - [self] - end - def value.[](key) + class Value < String + def [](key) $stderr.puts <<END CAUTION! cgi['key'] == cgi.params['key'][0] If want Array, use cgi.params['key'] END self - end - def value.first + end + def first $stderr.puts <<END CAUTION! cgi['key'] == cgi.params['key'][0] If want Array, use cgi.params['key'] END self - end end - value + end + + def [](key) + Value.new(@params[key][0]) end def keys(*args) diff --git a/lib/rational.rb b/lib/rational.rb index e63e8c481..0c784fb94 100644 --- a/lib/rational.rb +++ b/lib/rational.rb @@ -67,7 +67,9 @@ class Rational < Numeric def Rational.new!(num, den = 1) new(num, den) end - + + private_class_method :new + def initialize(num, den) if den < 0 num = -num |
