Module: Xenon::Routing::PathDirectives
Instance Method Summary
collapse
#complete, #extract, #extract_request, #fail, #map_request, #map_response, #reject
Instance Method Details
#path(pattern) ⇒ Object
27
28
29
30
31
32
33
|
# File 'lib/xenon/routing/path_directives.rb', line 27
def path(pattern)
path_prefix(pattern) do |*captures|
path_end do
yield *captures
end
end
end
|
#path_end ⇒ Object
21
22
23
24
25
|
# File 'lib/xenon/routing/path_directives.rb', line 21
def path_end
path_prefix(/\Z/) do
yield
end
end
|
#path_prefix(pattern) ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/xenon/routing/path_directives.rb', line 8
def path_prefix(pattern)
do |request|
match = request.unmatched_path.match(pattern)
if match && match.pre_match == ''
map_request unmatched_path: match.post_match do
yield *match.captures
end
else
reject nil
end
end
end
|