Class: ActionController::Routing::PathComponent
Overview
Defined Under Namespace
Classes: Result
Instance Attribute Summary
#key
Instance Method Summary
collapse
#add_segments_to, #assign_default, #assign_result, #default_check, #dynamic?, #initialize, #recognition_check, #write_continue_generation, #write_dropout_generation
Methods inherited from Component
#dynamic?, #key, new
Instance Method Details
#condition ⇒ Object
272
|
# File 'lib/action_controller/routing.rb', line 272
def condition() nil end
|
#default ⇒ Object
271
|
# File 'lib/action_controller/routing.rb', line 271
def default() [] end
|
#default=(value) ⇒ Object
274
275
276
|
# File 'lib/action_controller/routing.rb', line 274
def default=(value)
raise RoutingError, "All path components have an implicit default of []" unless value == []
end
|
#optional? ⇒ Boolean
270
|
# File 'lib/action_controller/routing.rb', line 270
def optional?() true end
|
#write_generation(g) ⇒ Object
278
279
280
281
282
283
284
285
|
# File 'lib/action_controller/routing.rb', line 278
def write_generation(g)
raise RoutingError, 'Path components must occur last' unless g.after.empty?
g.if("#{g.hash_value(key, true)} && ! #{g.hash_value(key, true)}.empty?") do
g << "#{g.hash_value(key, true)} = #{g.hash_value(key, true)}.join('/') unless #{g.hash_value(key, true)}.is_a?(String)"
g.add_segment("\#{CGI.escape_skipping_slashes(#{g.hash_value(key, true)})}") {|gp| gp.finish }
end
g.else { g.finish }
end
|
#write_recognition(g) ⇒ Object
287
288
289
290
291
292
293
294
295
296
|
# File 'lib/action_controller/routing.rb', line 287
def write_recognition(g)
raise RoutingError, "Path components must occur last" unless g.after.empty?
start = g.index_name
start = "(#{start})" unless /^\w+$/ =~ start
value_expr = "#{g.path_name}[#{start}..-1] || []"
g.result key, "ActionController::Routing::PathComponent::Result.new_escaped(#{value_expr})"
g.finish(false)
end
|