[#30589] [Bug #3391] Use single exclamation mark instead of double exclamation mark for IRB — Diego Viola <redmine@...>

Bug #3391: Use single exclamation mark instead of double exclamation mark for IRB

10 messages 2010/06/04

[#30672] [Bug #3411] Time.local 1916,5,1 #=> 1916-04-30 23:00:00 +0100 — Benoit Daloze <redmine@...>

Bug #3411: Time.local 1916,5,1 #=> 1916-04-30 23:00:00 +0100

12 messages 2010/06/08

[#30699] [Bug #3419] 1.9.2-preview3 possible bug with Rails 3 active_record sqlite_adapter — Joe Sak <redmine@...>

Bug #3419: 1.9.2-preview3 possible bug with Rails 3 active_record sqlite_adapter

9 messages 2010/06/09

[#30734] [Bug #3428] ri outputs ansi escape sequences even when stdout is not a tty — caleb clausen <redmine@...>

Bug #3428: ri outputs ansi escape sequences even when stdout is not a tty

11 messages 2010/06/11

[#30756] [Feature #3436] Spawn the timer thread lazily — Maximilian Gass <redmine@...>

Feature #3436: Spawn the timer thread lazily

15 messages 2010/06/13
[#32686] [Ruby 1.9-Feature#3436] Spawn the timer thread lazily — Mark Somerville <redmine@...> 2010/10/04

Issue #3436 has been updated by Mark Somerville.

[ruby-core:30980] Re: [Bug #3505] URI.join and Kernel::URI should accept URI objects

From: Marc-Andre Lafortune <ruby-core-mailing-list@...>
Date: 2010-06-30 20:18:25 UTC
List: ruby-core #30980
Hi!

On Tue, Jun 29, 2010 at 10:44 PM, Yui NARUSE <redmine@ruby-lang.org> wrote:
> I agree with this idea, but the patch has a problem; it breaks objects which have to_str.

Ah, indeed!

The following patch works better, then:


diff --git a/lib/uri/common.rb b/lib/uri/common.rb
index 58fd422..1ec4d0e 100644
--- a/lib/uri/common.rb
+++ b/lib/uri/common.rb
@@ -184,12 +184,15 @@ module URI
       end
     end

-    def join(*str)
-      u = self.parse(str[0])
-      str[1 .. -1].each do |x|
-       u = u.merge(x)
+    def join(*uris)
+      if uris[0].is_a?(URI::Generic)
+      elsif uri = String.try_convert(uri[0])
+        uris[0] = self.parse(uri)
+      else
+        raise ArgumentError,
+          "bad argument(expected URI object or URI string)"
       end
-      u
+      uris.inject :merge
     end

     def extract(str, schemes = nil, &block)
@@ -837,11 +840,19 @@ module URI
 end

 module Kernel
-  # alias for URI.parse.
+
   #
-  # This method is introduced at 1.8.2.
-  def URI(uri_str) # :doc:
-    URI.parse(uri_str)
+  # Returns +uri+ converted to a URI object.
+  #
+  def URI(uri)
+    if uri.is_a?(URI::Generic)
+      uri
+    elsif uri = String.try_convert(uri)
+      URI.parse(uri)
+    else
+      raise ArgumentError,
+        "bad argument (expected URI object or URI string)"
+    end
   end
   module_function :URI
 end

In This Thread

Prev Next