Class: Swaggard::Swagger::Tag
- Inherits:
-
Object
- Object
- Swaggard::Swagger::Tag
- Defined in:
- lib/swaggard/swagger/tag.rb
Instance Attribute Summary collapse
-
#controller_class ⇒ Object
readonly
Returns the value of attribute controller_class.
-
#description ⇒ Object
Returns the value of attribute description.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(yard_object) ⇒ Tag
constructor
A new instance of Tag.
- #to_doc ⇒ Object
Constructor Details
#initialize(yard_object) ⇒ Tag
Returns a new instance of Tag.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/swaggard/swagger/tag.rb', line 9 def initialize(yard_object) controller_name = "#{yard_object.namespace}::#{yard_object.name}" @yard_name = yard_object.name @controller_class = controller_name.constantize tag = yard_object..find { |tag| tag.tag_name == 'tag' } @name = tag ? tag.text : "#{@controller_class.controller_path}" @description = yard_object.docstring || '' end |
Instance Attribute Details
#controller_class ⇒ Object (readonly)
Returns the value of attribute controller_class.
7 8 9 |
# File 'lib/swaggard/swagger/tag.rb', line 7 def controller_class @controller_class end |
#description ⇒ Object
Returns the value of attribute description.
5 6 7 |
# File 'lib/swaggard/swagger/tag.rb', line 5 def description @description end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/swaggard/swagger/tag.rb', line 5 def name @name end |
Instance Method Details
#to_doc ⇒ Object
21 22 23 24 25 26 |
# File 'lib/swaggard/swagger/tag.rb', line 21 def to_doc { 'name' => @name, 'description' => @description } end |