Skip to content

Commit

Permalink
remove options as an ivar
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Jun 3, 2014
1 parent 981029b commit eaaf899
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions actionpack/lib/action_dispatch/routing/mapper.rb
Expand Up @@ -62,7 +62,7 @@ def constraint_args(constraint, request)
class Mapping #:nodoc: class Mapping #:nodoc:
ANCHOR_CHARACTERS_REGEX = %r{\A(\\A|\^)|(\\Z|\\z|\$)\Z} 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 attr_reader :to, :default_controller, :default_action, :as, :anchor


def initialize(scope, path, options) def initialize(scope, path, options)
Expand All @@ -85,10 +85,12 @@ def initialize(scope, path, options)
path = normalize_path! path, formatted path = normalize_path! path, formatted
ast = path_ast path ast = path_ast path
path_params = path_params ast 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] || {}), (scope[:constraints] || {}),
path_params) path_params)


Expand All @@ -98,7 +100,7 @@ def initialize(scope, path, options)
@conditions[:parsed_path_info] = ast @conditions[:parsed_path_info] = ast


add_request_method(via, @conditions) add_request_method(via, @conditions)
normalize_defaults!(formatted, options_constraints) normalize_defaults!(options, formatted, options_constraints)
end end


def to_route def to_route
Expand Down Expand Up @@ -178,7 +180,7 @@ def verify_regexp_requirement(requirement)
end end
end end


def normalize_defaults!(formatted, options_constraints) def normalize_defaults!(options, formatted, options_constraints)
options.each do |key, default| options.each do |key, default|
unless Regexp === default unless Regexp === default
@defaults[key] = default @defaults[key] = default
Expand Down Expand Up @@ -302,7 +304,7 @@ def blocks(options_constraints, scope_blocks)
end end
end end


def constraints(option_constraints, constraints, path_params) def constraints(options, option_constraints, constraints, path_params)
required_defaults = [] required_defaults = []
options.each_pair do |key, option| options.each_pair do |key, option|
if Regexp === option if Regexp === option
Expand Down

0 comments on commit eaaf899

Please sign in to comment.