summary refs log tree commit
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2015-06-24 12:14:01 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2015-06-24 12:14:01 -0700
commit2fd9df71aff4af8a3ab8088a6919f5d9a5e4ab95 (patch)
treef0ecfe1bade7ba267af26c8abaa123cce51cd89f
parentee18520bd9894e68a5d2b26c82835c2e67a43a8b (diff)
downloadrack-2fd9df71aff4af8a3ab8088a6919f5d9a5e4ab95.tar.gz
fix 1.8 backwards compat
-rw-r--r--HISTORY.md4
-rw-r--r--lib/rack/handler.rb14
2 files changed, 17 insertions, 1 deletions
diff --git a/HISTORY.md b/HISTORY.md
index 2635c605..f7795c5b 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -1,3 +1,7 @@
+Wed Jun 24 12:13:37 2015  Aaron Patterson <tenderlove@ruby-lang.org>
+
+        * Fix Ruby 1.8 backwards compatibility
+
 Fri Jun 19 07:14:50 2015  Matthew Draper <matthew@trebex.net>
 
         * Work around a Rails incompatibility in our private API
diff --git a/lib/rack/handler.rb b/lib/rack/handler.rb
index 8a5fadd5..03cac1b2 100644
--- a/lib/rack/handler.rb
+++ b/lib/rack/handler.rb
@@ -19,13 +19,25 @@ module Rack
       if klass = @handlers[server]
         klass.split("::").inject(Object) { |o, x| o.const_get(x) }
       else
-        const_get(server, false)
+        _const_get(server, false)
       end
 
     rescue NameError => name_error
       raise load_error || name_error
     end
 
+    begin
+      ::Object.const_get("Object", false)
+      def self._const_get(str, inherit = true)
+        const_get(str, inherit)
+      end
+    rescue
+      def self._const_get(str, inherit = true)
+        const_get(str)
+      end
+    end
+
+
     # Select first available Rack handler given an `Array` of server names.
     # Raises `LoadError` if no handler was found.
     #