Class: SwaggerDocsGenerator::Extractor
- Inherits:
-
Object
- Object
- SwaggerDocsGenerator::Extractor
- Defined in:
- lib/swagger_docs_generator/extractor.rb
Overview
# Extractor routes info
Give information about routes
Instance Method Summary collapse
-
#initialize(controller, action) ⇒ Extractor
constructor
A new instance of Extractor.
- #path ⇒ Object
- #verb ⇒ Object
Constructor Details
#initialize(controller, action) ⇒ Extractor
Returns a new instance of Extractor.
8 9 10 11 12 |
# File 'lib/swagger_docs_generator/extractor.rb', line 8 def initialize(controller, action) @action = action @controller = controller @routes = Rails.application.routes.routes end |
Instance Method Details
#path ⇒ Object
20 21 22 23 24 |
# File 'lib/swagger_docs_generator/extractor.rb', line 20 def path router do |route| route.path.spec.to_s.gsub('(.:format)', '.json').gsub(':id', '{id}') end end |
#verb ⇒ Object
14 15 16 17 18 |
# File 'lib/swagger_docs_generator/extractor.rb', line 14 def verb router do |route| route.verb.source.to_s.delete('$' + '^') end end |