diff options
| author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-04-23 06:31:29 +0000 |
|---|---|---|
| committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-04-23 06:31:29 +0000 |
| commit | 635a5e27ba912c6685820666a307ed1cd8926def (patch) | |
| tree | 08da4575f4d1164918e6a74e503d5de9a9b64b51 /lib | |
| parent | fe8a425101a83639379328fc643af015115dfe39 (diff) | |
| download | ruby-635a5e27ba912c6685820666a307ed1cd8926def.tar.gz ruby-635a5e27ba912c6685820666a307ed1cd8926def.tar.xz ruby-635a5e27ba912c6685820666a307ed1cd8926def.zip | |
* lib/cgi.rb (CGI::QueryExtension::[]): always return Value
object.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3717 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/cgi.rb | 4 | ||||
| -rw-r--r-- | lib/complex.rb | 4 | ||||
| -rw-r--r-- | lib/singleton.rb | 2 |
3 files changed, 6 insertions, 4 deletions
diff --git a/lib/cgi.rb b/lib/cgi.rb index 7dffdd9a3..dfeea5fc4 100644 --- a/lib/cgi.rb +++ b/lib/cgi.rb @@ -957,7 +957,9 @@ END end def [](key) - Value.new(@params[key][0]) + value = @params[key][0] + value ||= "" + Value.new(value) end def keys(*args) diff --git a/lib/complex.rb b/lib/complex.rb index dda2ad200..90916d125 100644 --- a/lib/complex.rb +++ b/lib/complex.rb @@ -13,7 +13,6 @@ # # Complex numbers can be created in the following manner: # - <tt>Complex(a, b)</tt> -# - <tt>Complex.new(a, b)</tt> # - <tt>Complex.polar(radius, theta)</tt> # # Additionally, note the following: @@ -66,7 +65,8 @@ class Complex < Numeric def Complex.polar(r, theta) Complex(r*Math.cos(theta), r*Math.sin(theta)) end - + + private_class_method :new # # Creates a +Complex+ number <tt>a</tt>+<tt>b</tt><i>i</i>. # diff --git a/lib/singleton.rb b/lib/singleton.rb index 147b04187..939159496 100644 --- a/lib/singleton.rb +++ b/lib/singleton.rb @@ -142,7 +142,7 @@ module Singleton @__instance__ = new ensure if @__instance__ - def self.instance() @__instance__ end + define_method(:instance) {@__instance__} else @__instance__ = nil # failed instance creation end |
