Class: DocMyRoutes::RouteDocumentation
- Inherits:
-
Object
- Object
- DocMyRoutes::RouteDocumentation
- Defined in:
- lib/doc_my_routes/doc/route_documentation.rb
Overview
Class holding documentation information about a given route
Instance Attribute Summary collapse
-
#examples ⇒ Object
readonly
Returns the value of attribute examples.
-
#examples_regex ⇒ Object
Returns the value of attribute examples_regex.
-
#hidden ⇒ Object
Returns the value of attribute hidden.
-
#notes ⇒ Object
Returns the value of attribute notes.
-
#notes_ref ⇒ Object
Returns the value of attribute notes_ref.
-
#produces ⇒ Object
Returns the value of attribute produces.
-
#status_codes ⇒ Object
Returns the value of attribute status_codes.
-
#summary ⇒ Object
Returns the value of attribute summary.
Instance Method Summary collapse
- #hidden? ⇒ Boolean
-
#initialize ⇒ RouteDocumentation
constructor
A new instance of RouteDocumentation.
-
#present? ⇒ Boolean
A route documentation object MUST have a summary, otherwise is not considered documented.
- #to_hash ⇒ Object
Constructor Details
#initialize ⇒ RouteDocumentation
Returns a new instance of RouteDocumentation.
8 9 10 11 12 |
# File 'lib/doc_my_routes/doc/route_documentation.rb', line 8 def initialize @status_codes = { 200 => DocMyRoutes::StatusCodeInfo::STATUS_CODES[200] } @hidden = false @produces = [] end |
Instance Attribute Details
#examples ⇒ Object (readonly)
Returns the value of attribute examples.
6 7 8 |
# File 'lib/doc_my_routes/doc/route_documentation.rb', line 6 def examples @examples end |
#examples_regex ⇒ Object
Returns the value of attribute examples_regex.
4 5 6 |
# File 'lib/doc_my_routes/doc/route_documentation.rb', line 4 def examples_regex @examples_regex end |
#hidden ⇒ Object
Returns the value of attribute hidden.
4 5 6 |
# File 'lib/doc_my_routes/doc/route_documentation.rb', line 4 def hidden @hidden end |
#notes ⇒ Object
Returns the value of attribute notes.
4 5 6 |
# File 'lib/doc_my_routes/doc/route_documentation.rb', line 4 def notes @notes end |
#notes_ref ⇒ Object
Returns the value of attribute notes_ref.
4 5 6 |
# File 'lib/doc_my_routes/doc/route_documentation.rb', line 4 def notes_ref @notes_ref end |
#produces ⇒ Object
Returns the value of attribute produces.
4 5 6 |
# File 'lib/doc_my_routes/doc/route_documentation.rb', line 4 def produces @produces end |
#status_codes ⇒ Object
Returns the value of attribute status_codes.
4 5 6 |
# File 'lib/doc_my_routes/doc/route_documentation.rb', line 4 def status_codes @status_codes end |
#summary ⇒ Object
Returns the value of attribute summary.
4 5 6 |
# File 'lib/doc_my_routes/doc/route_documentation.rb', line 4 def summary @summary end |
Instance Method Details
#hidden? ⇒ Boolean
74 75 76 |
# File 'lib/doc_my_routes/doc/route_documentation.rb', line 74 def hidden? !!@hidden end |
#present? ⇒ Boolean
A route documentation object MUST have a summary, otherwise is not considered documented
16 17 18 |
# File 'lib/doc_my_routes/doc/route_documentation.rb', line 16 def present? !summary.nil? end |
#to_hash ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/doc_my_routes/doc/route_documentation.rb', line 20 def to_hash { summary: summary, notes: notes, status_codes: status_codes, examples_regex: examples_regex, produces: produces, examples: examples, hidden: hidden? } end |