Class: ActionController::Routing::ControllerSegment
- Inherits:
-
DynamicSegment
- Object
- Segment
- DynamicSegment
- ActionController::Routing::ControllerSegment
- Defined in:
- lib/action_controller/routing/segments.rb
Overview
:nodoc:
Constant Summary
Constants inherited from Segment
Segment::RESERVED_PCHAR, Segment::SAFE_PCHAR, Segment::UNSAFE_PCHAR
Instance Attribute Summary
Attributes inherited from DynamicSegment
Attributes inherited from Segment
Instance Method Summary collapse
-
#extract_value ⇒ Object
Make sure controller names like Admin/Content are correctly normalized to admin/content.
-
#interpolation_chunk(value_code = local_name) ⇒ Object
Don’t URI.escape the controller name since it may contain slashes.
- #match_extraction(next_capture) ⇒ Object
- #number_of_captures ⇒ Object
- #regexp_chunk ⇒ Object
Methods inherited from DynamicSegment
#build_pattern, #expiry_statement, #extraction_code, #initialize, #local_name, #optionality_implied?, #regexp_has_modifiers?, #string_structure, #to_s, #value_check, #value_regexp
Methods inherited from Segment
#all_optionals_available_condition, #continue_string_structure, #extraction_code, #initialize, #interpolation_statement, #optionality_implied?, #string_structure
Constructor Details
This class inherits a constructor from ActionController::Routing::DynamicSegment
Instance Method Details
#extract_value ⇒ Object
Make sure controller names like Admin/Content are correctly normalized to admin/content
258 259 260 |
# File 'lib/action_controller/routing/segments.rb', line 258 def extract_value "#{local_name} = (hash[:#{key}] #{"|| #{default.inspect}" if default}).downcase" end |
#interpolation_chunk(value_code = local_name) ⇒ Object
Don’t URI.escape the controller name since it may contain slashes.
252 253 254 |
# File 'lib/action_controller/routing/segments.rb', line 252 def interpolation_chunk(value_code = local_name) "\#{#{value_code}.to_s}" end |
#match_extraction(next_capture) ⇒ Object
262 263 264 265 266 267 268 |
# File 'lib/action_controller/routing/segments.rb', line 262 def match_extraction(next_capture) if default "params[:#{key}] = match[#{next_capture}] ? match[#{next_capture}].downcase : '#{default}'" else "params[:#{key}] = match[#{next_capture}].downcase if match[#{next_capture}]" end end |
#number_of_captures ⇒ Object
247 248 249 |
# File 'lib/action_controller/routing/segments.rb', line 247 def number_of_captures 1 end |
#regexp_chunk ⇒ Object
242 243 244 245 |
# File 'lib/action_controller/routing/segments.rb', line 242 def regexp_chunk possible_names = Routing.possible_controllers.collect { |name| Regexp.escape name } "(?i-:(#{(regexp || Regexp.union(*possible_names)).source}))" end |