Class: DocMyRoutes::RouteDocumentation

Inherits:
Object
  • Object
show all
Defined in:
lib/doc_my_routes/doc/route_documentation.rb

Overview

Class holding documentation information about a given route

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRouteDocumentation

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

#examplesObject (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_regexObject

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

#hiddenObject

Returns the value of attribute hidden.



4
5
6
# File 'lib/doc_my_routes/doc/route_documentation.rb', line 4

def hidden
  @hidden
end

#notesObject

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_refObject

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

#producesObject

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_codesObject

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

#summaryObject

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

Returns:

  • (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

Returns:

  • (Boolean)


16
17
18
# File 'lib/doc_my_routes/doc/route_documentation.rb', line 16

def present?
  !summary.nil?
end

#to_hashObject



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