13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/dandy/routing/builder.rb', line 13
def build(sections)
result = []
node = sections.node
restore_hierarchy(node, nil, node.to_hash)
@route_params.each do |route|
if route[:actions]
route[:actions].each do |action|
result << Route.new({
path: restore_path(route).gsub('$', '/$'),
params: restore_params(route).map{|p| p.sub('$', '')},
http_verb: action[:http_verb],
view: action[:view],
http_status: action[:http_status],
catch: sections.catch.command,
commands: restore_callbacks(route, :before) + action[:commands] + restore_callbacks(route, :after)
})
end
end
end
result
end
|