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.
-
#parameters ⇒ Object
readonly
Returns the value of attribute parameters.
-
#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
- #add_parameter(name, options) ⇒ Object
- #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 13 |
# File 'lib/doc_my_routes/doc/route_documentation.rb', line 8 def initialize @status_codes = { 200 => DocMyRoutes::StatusCodeInfo::STATUS_CODES[200] } @hidden = false @produces = [] @parameters = {} 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 |
#parameters ⇒ Object (readonly)
Returns the value of attribute parameters.
6 7 8 |
# File 'lib/doc_my_routes/doc/route_documentation.rb', line 6 def parameters @parameters 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
#add_parameter(name, options) ⇒ Object
38 39 40 |
# File 'lib/doc_my_routes/doc/route_documentation.rb', line 38 def add_parameter(name, ) @parameters[name] = end |
#hidden? ⇒ Boolean
80 81 82 |
# File 'lib/doc_my_routes/doc/route_documentation.rb', line 80 def hidden? !!@hidden end |
#present? ⇒ Boolean
A route documentation object MUST have a summary, otherwise is not considered documented
17 18 19 |
# File 'lib/doc_my_routes/doc/route_documentation.rb', line 17 def present? !summary.nil? end |
#to_hash ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/doc_my_routes/doc/route_documentation.rb', line 21 def to_hash { summary: summary, notes: notes, status_codes: status_codes, examples_regex: examples_regex, produces: produces, examples: examples, parameters: parameters, hidden: hidden? } end |