Class: SwaggerDocsGenerator::Parser Abstract
- Inherits:
-
Object
- Object
- SwaggerDocsGenerator::Parser
- Defined in:
- lib/swagger_docs_generator/parser/parser.rb
Overview
This class is abstract.
Classes for parsing Rails classes
# Parse classes
Direct Known Subclasses
Instance Attribute Summary collapse
-
#controller ⇒ Object
readonly
It’s a name of controller parsed.
-
#tag_name ⇒ Object
readonly
It’s a tag attaching to controller.
Instance Method Summary collapse
-
#initialize(klass) ⇒ Parser
constructor
A new instance of Parser.
- #temporary_file ⇒ Object
Constructor Details
#initialize(klass) ⇒ Parser
Returns a new instance of Parser.
15 16 17 18 |
# File 'lib/swagger_docs_generator/parser/parser.rb', line 15 def initialize(klass) @controller = klass::CONTROLLER @tag_name = defined?(klass::TAG) ? klass::TAG : controller_name end |
Instance Attribute Details
#controller ⇒ Object (readonly)
It’s a name of controller parsed
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/swagger_docs_generator/parser/parser.rb', line 12 class Parser attr_reader :controller, :tag_name def initialize(klass) @controller = klass::CONTROLLER @tag_name = defined?(klass::TAG) ? klass::TAG : controller_name end def temporary_file File.join(SwaggerDocsGenerator.temporary_folder, tmp_json) end private def controller_name @controller.controller_name end def tmp_json "#{@tag_name}.json" end end |
#tag_name ⇒ Object (readonly)
It’s a tag attaching to controller
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/swagger_docs_generator/parser/parser.rb', line 12 class Parser attr_reader :controller, :tag_name def initialize(klass) @controller = klass::CONTROLLER @tag_name = defined?(klass::TAG) ? klass::TAG : controller_name end def temporary_file File.join(SwaggerDocsGenerator.temporary_folder, tmp_json) end private def controller_name @controller.controller_name end def tmp_json "#{@tag_name}.json" end end |
Instance Method Details
#temporary_file ⇒ Object
20 21 22 |
# File 'lib/swagger_docs_generator/parser/parser.rb', line 20 def temporary_file File.join(SwaggerDocsGenerator.temporary_folder, tmp_json) end |