Skip to content

Instantly share code, notes, and snippets.

@tanzeeb
Created June 6, 2011 03:13
Show Gist options
  • Save tanzeeb/1009681 to your computer and use it in GitHub Desktop.
Save tanzeeb/1009681 to your computer and use it in GitHub Desktop.
Rubinius: fix failing URI specs
From e5fa08b75ef35a54f8decc49e49d9de0502fe561 Mon Sep 17 00:00:00 2001
From: Tanzeeb Khalili <tanzeeb@gmail.com>
Date: Sun, 5 Jun 2011 22:43:21 -0400
Subject: [PATCH 1/2] fixed URI.join specs
---
lib/uri/common.rb | 2 +-
lib/uri/generic.rb | 1 +
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/lib/uri/common.rb b/lib/uri/common.rb
index 433ea67..7daa7da 100644
--- a/lib/uri/common.rb
+++ b/lib/uri/common.rb
@@ -517,7 +517,7 @@ module URI
# # => #<URI::HTTP:0x2022ac02 URL:http://localhost/main.rbx>
#
def self.join(*str)
- u = self.parse(str[0])
+ u = str[0].kind_of?(URI) ? str[0] : self.parse(str[0])
str[1 .. -1].each do |x|
u = u.merge(x)
end
diff --git a/lib/uri/generic.rb b/lib/uri/generic.rb
index cafde4c..8a5d686 100644
--- a/lib/uri/generic.rb
+++ b/lib/uri/generic.rb
@@ -769,6 +769,7 @@ module URI
# return base and rel.
# you can modify `base', but can not `rel'.
def merge0(oth)
+ oth = oth.to_str if oth.respond_to?(:to_str)
case oth
when Generic
when String
--
1.7.3.4
From dce738336164153f92155680633da8b75ab86b00 Mon Sep 17 00:00:00 2001
From: Tanzeeb Khalili <tanzeeb@gmail.com>
Date: Sun, 5 Jun 2011 23:10:21 -0400
Subject: [PATCH 2/2] fix URI specs
---
lib/uri/generic.rb | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/lib/uri/generic.rb b/lib/uri/generic.rb
index 8a5d686..84f5b21 100644
--- a/lib/uri/generic.rb
+++ b/lib/uri/generic.rb
@@ -841,6 +841,7 @@ module URI
private :route_from_path
def route_from0(oth)
+ oth = oth.to_str if oth.respond_to?(:to_str)
case oth
when Generic
when String
@@ -953,6 +954,7 @@ module URI
# #=> #<URI::Generic:0x2020c2f6 URL:/main.rbx?page=1>
#
def route_to(oth)
+ oth = oth.to_str if oth.respond_to?(:to_str)
case oth
when Generic
when String
--
1.7.3.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment