diff options
author | Misaki Shioi <shioi.mm@gmail.com> | 2019-08-13 20:13:39 +0900 |
---|---|---|
committer | Misaki Shioi <shioi.mm@gmail.com> | 2019-08-13 20:50:06 +0900 |
commit | 516f0e84a31147fbf2b8a6ec54065829d1e2d8b4 (patch) | |
tree | 88457ee3c360f31efbf43974d83c1cf1ef4b2d18 | |
parent | bbd2a93f422508c615ae23d007c34b8bfb405b91 (diff) | |
download | rack-516f0e84a31147fbf2b8a6ec54065829d1e2d8b4.tar.gz |
Use `const_get` to get klass without `inject`
`Enumerable#inject` was used to get constant in `Rack::Handler.get`. But `Object#const_get` is available to get nested constant from Ruby version 2.0.0. And the required minimum ruby version of Rack is 2.2.2. It seems that `const_get` doesn't need `inject` anymore, and this change is for replacing it without `inject`.
-rw-r--r-- | lib/rack/handler.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/rack/handler.rb b/lib/rack/handler.rb index bc0a3bf8..0705c58b 100644 --- a/lib/rack/handler.rb +++ b/lib/rack/handler.rb @@ -19,7 +19,7 @@ module Rack end if klass = @handlers[server] - klass.split("::").inject(Object) { |o, x| o.const_get(x) } + const_get(klass) else const_get(server, false) end |