diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-11-29 17:01:14 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-11-29 17:01:14 -0600 |
commit | 5da01a92c741b3a9a020a4dec9ddf120c0484e20 (patch) | |
tree | a52e9e44e727eef7b262ccf6cb2b21bfd64a20d1 /actionpack/lib | |
parent | 40ae2070d57867bac1c9e7f77c25ac7ac7b5a647 (diff) | |
download | rails-5da01a92c741b3a9a020a4dec9ddf120c0484e20.tar.gz rails-5da01a92c741b3a9a020a4dec9ddf120c0484e20.tar.bz2 rails-5da01a92c741b3a9a020a4dec9ddf120c0484e20.zip |
Make use of extract_options!
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 9b00bd3dc0..9ec85daba8 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -68,7 +68,7 @@ module ActionDispatch end def resource(*resources, &block) - options = resources.last.is_a?(Hash) ? resources.pop : {} + options = resources.extract_options! if resources.length > 1 raise ArgumentError if block_given? @@ -105,7 +105,7 @@ module ActionDispatch end def resources(*resources, &block) - options = resources.last.is_a?(Hash) ? resources.pop : {} + options = resources.extract_options! if resources.length > 1 raise ArgumentError if block_given? @@ -173,7 +173,7 @@ module ActionDispatch end def match(*args) - options = args.last.is_a?(Hash) ? args.pop : {} + options = args.extract_options! args.push(options) case options.delete(:on) @@ -203,7 +203,7 @@ module ActionDispatch module Scoping def scope(*args) - options = args.last.is_a?(Hash) ? args.pop : {} + options = args.extract_options! constraints = options.delete(:constraints) || {} unless constraints.is_a?(Hash) @@ -300,7 +300,7 @@ module ActionDispatch end def match(*args) - options = args.last.is_a?(Hash) ? args.pop : {} + options = args.extract_options! if args.length > 1 args.each { |path| match(path, options) } @@ -384,7 +384,7 @@ module ActionDispatch private def map_method(method, *args, &block) - options = args.last.is_a?(Hash) ? args.pop : {} + options = args.extract_options! options[:via] = method args.push(options) match(*args, &block) |