提交 eaaf8995 编写于 作者: A Aaron Patterson

remove options as an ivar

上级 981029b3
......@@ -62,7 +62,7 @@ def constraint_args(constraint, request)
class Mapping #:nodoc:
ANCHOR_CHARACTERS_REGEX = %r{\A(\\A|\^)|(\\Z|\\z|\$)\Z}
attr_reader :options, :requirements, :conditions, :defaults
attr_reader :requirements, :conditions, :defaults
attr_reader :to, :default_controller, :default_action, :as, :anchor
def initialize(scope, path, options)
......@@ -85,10 +85,12 @@ def initialize(scope, path, options)
path = normalize_path! path, formatted
ast = path_ast path
path_params = path_params ast
@options = normalize_options!(options, formatted, path_params, ast, scope[:module])
options = normalize_options!(options, formatted, path_params, ast, scope[:module])
constraints = constraints(options_constraints,
constraints = constraints(options,
options_constraints,
(scope[:constraints] || {}),
path_params)
......@@ -98,7 +100,7 @@ def initialize(scope, path, options)
@conditions[:parsed_path_info] = ast
add_request_method(via, @conditions)
normalize_defaults!(formatted, options_constraints)
normalize_defaults!(options, formatted, options_constraints)
end
def to_route
......@@ -178,7 +180,7 @@ def verify_regexp_requirement(requirement)
end
end
def normalize_defaults!(formatted, options_constraints)
def normalize_defaults!(options, formatted, options_constraints)
options.each do |key, default|
unless Regexp === default
@defaults[key] = default
......@@ -302,7 +304,7 @@ def blocks(options_constraints, scope_blocks)
end
end
def constraints(option_constraints, constraints, path_params)
def constraints(options, option_constraints, constraints, path_params)
required_defaults = []
options.each_pair do |key, option|
if Regexp === option
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册