Class: Brainstem::ApiDocs::Formatters::Markdown::ControllerFormatter

Inherits:
AbstractFormatter
  • Object
show all
Includes:
Helper
Defined in:
lib/brainstem/api_docs/formatters/markdown/controller_formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helper

#md_a, #md_code, #md_h1, #md_h2, #md_h3, #md_h4, #md_h5, #md_hr, #md_inline_code, #md_inline_type, #md_li, #md_p, #md_strong, #md_ul

Methods inherited from AbstractFormatter

call

Constructor Details

#initialize(controller, options = {}) ⇒ ControllerFormatter

Returns a new instance of ControllerFormatter.



26
27
28
29
30
31
# File 'lib/brainstem/api_docs/formatters/markdown/controller_formatter.rb', line 26

def initialize(controller, options = {})
  self.controller      = controller
  self.output          = ""
  self.include_actions = false
  super options
end

Instance Attribute Details

#controllerObject

Returns the value of attribute controller.



20
21
22
# File 'lib/brainstem/api_docs/formatters/markdown/controller_formatter.rb', line 20

def controller
  @controller
end

#include_actionsObject Also known as: include_actions?

Returns the value of attribute include_actions.



20
21
22
# File 'lib/brainstem/api_docs/formatters/markdown/controller_formatter.rb', line 20

def include_actions
  @include_actions
end

#outputObject

Returns the value of attribute output.



20
21
22
# File 'lib/brainstem/api_docs/formatters/markdown/controller_formatter.rb', line 20

def output
  @output
end

Instance Method Details

#callObject



33
34
35
36
37
38
# File 'lib/brainstem/api_docs/formatters/markdown/controller_formatter.rb', line 33

def call
  return output if controller.nodoc?
  format_title!
  format_description!
  format_actions!
end

#valid_optionsObject

Declares the options that are permissable to set on this instance.



14
15
16
17
18
# File 'lib/brainstem/api_docs/formatters/markdown/controller_formatter.rb', line 14

def valid_options
  super | [
    :include_actions
  ]
end