Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make use of extract_options!

  • Loading branch information...
commit 5da01a92c741b3a9a020a4dec9ddf120c0484e20 1 parent 40ae207
Joshua Peek josh authored
Showing with 6 additions and 6 deletions.
  1. +6 −6 actionpack/lib/action_dispatch/routing/mapper.rb
12 actionpack/lib/action_dispatch/routing/mapper.rb
View
@@ -68,7 +68,7 @@ def name
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 @@ def resource(*resources, &block)
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 @@ def member
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 @@ def with_scope_level(kind, options = {})
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 @@ def root(options = {})
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 @@ def redirect(path, options = {})
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)
Please sign in to comment.
Something went wrong with that request. Please try again.