Class: ActionController::Routing::PathSegment
Overview
Defined Under Namespace
Classes: Result
Constant Summary
Constants inherited
from Segment
Segment::RESERVED_PCHAR, Segment::UNSAFE_PCHAR
Instance Attribute Summary
#key, #regexp
Attributes inherited from Segment
#is_optional
Instance Method Summary
collapse
#build_pattern, #expiry_statement, #extraction_code, #initialize, #local_name, #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, #string_structure
Instance Method Details
255
256
257
|
# File 'lib/action_controller/routing/segments.rb', line 255
def default
''
end
|
#default=(path) ⇒ Object
259
260
261
|
# File 'lib/action_controller/routing/segments.rb', line 259
def default=(path)
raise RoutingError, "paths cannot have non-empty default values" unless path.blank?
end
|
251
252
253
|
# File 'lib/action_controller/routing/segments.rb', line 251
def
"#{local_name} = hash[:#{key}] && Array(hash[:#{key}]).collect { |path_component| URI.escape(path_component.to_param, ActionController::Routing::Segment::UNSAFE_PCHAR) }.to_param #{"|| #{default.inspect}" if default}"
end
|
#interpolation_chunk(value_code = "#{local_name}") ⇒ Object
247
248
249
|
# File 'lib/action_controller/routing/segments.rb', line 247
def interpolation_chunk(value_code = "#{local_name}")
"\#{#{value_code}}"
end
|
263
264
265
|
# File 'lib/action_controller/routing/segments.rb', line 263
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
271
272
273
|
# File 'lib/action_controller/routing/segments.rb', line 271
def optionality_implied?
true
end
|
#regexp_chunk ⇒ Object
267
268
269
|
# File 'lib/action_controller/routing/segments.rb', line 267
def regexp_chunk
regexp || "(.*)"
end
|