5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/swaggard/parsers/routes.rb', line 5
def run(routes)
return {} unless routes
routes.inject({}) do |parsed_routes, route|
path = route_path(route)
unless Swaggard.configuration.excluded_paths.any? { |excluded_path| Regexp.new(excluded_path) =~ path }
verb = route_verb(route)
parsed_routes[path] ||= {}
parsed_routes[path][verb] = {
controller: route_controller(route),
action: route_action(route),
path_params: route_path_params(route)
}
end
parsed_routes
end.sort.to_h
end
|