diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-06-24 12:14:01 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-06-24 12:14:01 -0700 |
commit | 2fd9df71aff4af8a3ab8088a6919f5d9a5e4ab95 (patch) | |
tree | f0ecfe1bade7ba267af26c8abaa123cce51cd89f | |
parent | ee18520bd9894e68a5d2b26c82835c2e67a43a8b (diff) | |
download | rack-2fd9df71aff4af8a3ab8088a6919f5d9a5e4ab95.tar.gz |
fix 1.8 backwards compat
-rw-r--r-- | HISTORY.md | 4 | ||||
-rw-r--r-- | lib/rack/handler.rb | 14 |
2 files changed, 17 insertions, 1 deletions
@@ -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. # |