Class: ActionController::Routing::PathSegment
Overview
Defined Under Namespace
Classes: Result
Constant Summary
collapse
- RESERVED_PCHAR =
"#{Segment::RESERVED_PCHAR}/"
- UNSAFE_PCHAR =
Regexp.new("[^#{URI::REGEXP::PATTERN::UNRESERVED}#{RESERVED_PCHAR}]", false, 'N').freeze
Instance Attribute Summary
#key, #regexp
Attributes inherited from Segment
#is_optional
Instance Method Summary
collapse
#build_pattern, #expiry_statement, #extract_value, #extraction_code, #initialize, #local_name, #string_structure, #to_s, #value_check, #value_regexp
Methods inherited from Segment
#all_optionals_available_condition, #continue_string_structure, #extraction_code, #initialize, #interpolation_statement, #string_structure
Instance Method Details
829
830
831
|
# File 'lib/action_controller/routing.rb', line 829
def default
''
end
|
#default=(path) ⇒ Object
833
834
835
|
# File 'lib/action_controller/routing.rb', line 833
def default=(path)
raise RoutingError, "paths cannot have non-empty default values" unless path.blank?
end
|
#interpolation_chunk(value_code = "#{local_name}") ⇒ Object
825
826
827
|
# File 'lib/action_controller/routing.rb', line 825
def interpolation_chunk(value_code = "#{local_name}")
"\#{URI.escape(#{value_code}.to_s, ActionController::Routing::PathSegment::UNSAFE_PCHAR)}"
end
|
837
838
839
|
# File 'lib/action_controller/routing.rb', line 837
def (next_capture)
"params[:#{key}] = PathSegment::Result.new_escaped((match[#{next_capture}]#{" || " + default.inspect if default}).split('/'))#{" if match[" + next_capture + "]" if !default}"
end
|
#optionality_implied? ⇒ Boolean
845
846
847
|
# File 'lib/action_controller/routing.rb', line 845
def optionality_implied?
true
end
|
#regexp_chunk ⇒ Object
841
842
843
|
# File 'lib/action_controller/routing.rb', line 841
def regexp_chunk
regexp || "(.*)"
end
|