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.
-
#controller_name ⇒ Object
readonly
Returns the value of attribute controller_name.
-
#description ⇒ Object
Returns the value of attribute description.
-
#name ⇒ Object
Returns the value of attribute name.
-
#route ⇒ Object
readonly
Returns the value of attribute route.
Instance Method Summary collapse
-
#initialize(yard_object, tag) ⇒ Tag
constructor
A new instance of Tag.
- #to_doc ⇒ Object
Constructor Details
#initialize(yard_object, tag) ⇒ Tag
Returns a new instance of Tag.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/swaggard/swagger/tag.rb', line 8 def initialize(yard_object, tag) controller_name = "#{yard_object.namespace}::#{yard_object.name}" @yard_name = yard_object.name @controller_class = controller_name.constantize @controller_name = controller_class.controller_path @name = tag ? tag.text : "#{@controller_class.controller_path}" @name, @route = @name.split(' ') @description = yard_object.docstring || '' end |
Instance Attribute Details
#controller_class ⇒ Object (readonly)
Returns the value of attribute controller_class.
6 7 8 |
# File 'lib/swaggard/swagger/tag.rb', line 6 def controller_class @controller_class end |
#controller_name ⇒ Object (readonly)
Returns the value of attribute controller_name.
6 7 8 |
# File 'lib/swaggard/swagger/tag.rb', line 6 def controller_name @controller_name end |
#description ⇒ Object
Returns the value of attribute description.
4 5 6 |
# File 'lib/swaggard/swagger/tag.rb', line 4 def description @description end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/swaggard/swagger/tag.rb', line 4 def name @name end |
#route ⇒ Object (readonly)
Returns the value of attribute route.
6 7 8 |
# File 'lib/swaggard/swagger/tag.rb', line 6 def route @route 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 |