Class: Rswag::RouteParser
- Inherits:
-
Object
- Object
- Rswag::RouteParser
- Defined in:
- lib/rswag/route_parser.rb
Instance Attribute Summary collapse
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
Instance Method Summary collapse
-
#initialize(controller) ⇒ RouteParser
constructor
A new instance of RouteParser.
- #routes ⇒ Object
Constructor Details
#initialize(controller) ⇒ RouteParser
Returns a new instance of RouteParser.
7 8 9 |
# File 'lib/rswag/route_parser.rb', line 7 def initialize(controller) @controller = controller end |
Instance Attribute Details
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
5 6 7 |
# File 'lib/rswag/route_parser.rb', line 5 def controller @controller end |
Instance Method Details
#routes ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/rswag/route_parser.rb', line 11 def routes ::Rails.application.routes.routes.select do |route| route.defaults[:controller] == controller end.each_with_object({}) do |route, tree| path = path_from(route) verb = verb_from(route) tree[path] ||= { params: params_from(route), actions: {} } tree[path][:actions][verb] = { summary: summary_from(route) } tree end end |