diff options
author | Jean Boussier <jean.boussier@gmail.com> | 2019-04-10 13:42:08 +0200 |
---|---|---|
committer | Jean Boussier <jean.boussier@gmail.com> | 2019-04-10 13:42:08 +0200 |
commit | fdfd9e399f440fc6b4bec7d16ae5114318aee1a9 (patch) | |
tree | 2f0b440b70a43b663a1ae46157a97d24e7554ba2 | |
parent | a8328f61b6b958140738d5c31438132b20089c93 (diff) | |
download | rails-fdfd9e399f440fc6b4bec7d16ae5114318aee1a9.tar.gz rails-fdfd9e399f440fc6b4bec7d16ae5114318aee1a9.tar.bz2 rails-fdfd9e399f440fc6b4bec7d16ae5114318aee1a9.zip |
Simplify and fasten NamedRouteCollection#define_url_helper
-rw-r--r-- | actionpack/lib/action_dispatch/routing/route_set.rb | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index d0a7eadf45..4a24c35efb 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -317,18 +317,16 @@ module ActionDispatch # def define_url_helper(mod, route, name, opts, route_key, url_strategy) helper = UrlHelper.create(route, opts, route_key, url_strategy) - mod.module_eval do - define_method(name) do |*args| - last = args.last - options = \ - case last - when Hash - args.pop - when ActionController::Parameters - args.pop.to_h - end - helper.call self, args, options - end + mod.define_method(name) do |*args| + last = args.last + options = \ + case last + when Hash + args.pop + when ActionController::Parameters + args.pop.to_h + end + helper.call self, args, options end end end |