method
new
v4.2.7 -
Show latest stable
-
0 notes -
Class: ActionDispatch::Routing::Mapper::Mapping
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0
- 2.2.1
- 2.3.8
- 3.0.0 (0)
- 3.0.9 (0)
- 3.1.0 (0)
- 3.2.1 (0)
- 3.2.8 (0)
- 3.2.13 (0)
- 4.0.2 (0)
- 4.1.8 (0)
- 4.2.1 (0)
- 4.2.7 (0)
- 4.2.9 (0)
- 5.0.0.1 (0)
- 5.1.7 (0)
- 5.2.3 (0)
- 6.0.0 (0)
- 6.1.3.1 (0)
- 6.1.7.7 (0)
- 7.0.0 (0)
- 7.1.3.2 (0)
- 7.1.3.4 (0)
- What's this?
new(scope, set, path, defaults, as, options)
public
Hide source
# File actionpack/lib/action_dispatch/routing/mapper.rb, line 81 def initialize(scope, set, path, defaults, as, options) @requirements, @conditions = {}, {} @defaults = defaults @set = set @to = options.delete :to @default_controller = options.delete(:controller) || scope[:controller] @default_action = options.delete(:action) || scope[:action] @as = as @anchor = options.delete :anchor formatted = options.delete :format via = Array(options.delete(:via) { [] }) options_constraints = options.delete :constraints path = normalize_path! path, formatted ast = path_ast path path_params = path_params ast options = normalize_options!(options, formatted, path_params, ast, scope[:module]) split_constraints(path_params, scope[:constraints]) if scope[:constraints] constraints = constraints(options, path_params) split_constraints path_params, constraints @blocks = blocks(options_constraints, scope[:blocks]) if options_constraints.is_a?(Hash) split_constraints path_params, options_constraints options_constraints.each do |key, default| if URL_OPTIONS.include?(key) && (String === default || Fixnum === default) @defaults[key] ||= default end end end normalize_format!(formatted) @conditions[:path_info] = path @conditions[:parsed_path_info] = ast add_request_method(via, @conditions) normalize_defaults!(options) end