Class: SwaggerDocsGenerator::ParserController
- Defined in:
- lib/swagger_docs_generator/parser/controller.rb
Overview
# Parse Controller classes
Parse controller classes in Rails application. It’s create temporary file and adding automaticaly tags element.
Instance Attribute Summary
Attributes inherited from Parser
Instance Method Summary collapse
- #adding_tag ⇒ Object
-
#initialize(controller, description) ⇒ ParserController
constructor
A new instance of ParserController.
Methods inherited from Parser
Constructor Details
#initialize(controller, description) ⇒ ParserController
Returns a new instance of ParserController.
9 10 11 12 13 |
# File 'lib/swagger_docs_generator/parser/controller.rb', line 9 def initialize(controller, description) super(controller) prepare_file @description = description end |
Instance Method Details
#adding_tag ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/swagger_docs_generator/parser/controller.rb', line 15 def adding_tag json = JSON.parse(File.read(controller_file)) File.open(controller_file, 'w') do |file| hash = (@description) json['tags'].merge!(hash) file.puts(JSON.pretty_generate(json)) end end |