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(description) ⇒ ParserController
constructor
A new instance of ParserController.
Methods inherited from Parser
Constructor Details
#initialize(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(description) super(binding.of_callers[1].klass) @description = description prepare_file end |
Instance Method Details
#adding_tag ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/swagger_docs_generator/parser/controller.rb', line 15 def adding_tag json = JSON.parse(File.read(temporary_file)) File.open(temporary_file, 'w') do |file| json['tags'].merge!() file.puts(JSON.pretty_generate(json)) end end |