Class: Brainstem::ApiDocs::Formatters::OpenApiSpecification::Version2::ControllerFormatter

Inherits:
AbstractFormatter
  • Object
show all
Defined in:
lib/brainstem/api_docs/formatters/open_api_specification/version_2/controller_formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractFormatter

call

Constructor Details

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

Returns a new instance of ControllerFormatter.



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

def initialize(controller, options = {})
  self.controller      = controller
  self.output          = {}
  self.include_actions = true

  super options
end

Instance Attribute Details

#controllerObject

Returns the value of attribute controller.



19
20
21
# File 'lib/brainstem/api_docs/formatters/open_api_specification/version_2/controller_formatter.rb', line 19

def controller
  @controller
end

#include_actionsObject Also known as: include_actions?

Returns the value of attribute include_actions.



19
20
21
# File 'lib/brainstem/api_docs/formatters/open_api_specification/version_2/controller_formatter.rb', line 19

def include_actions
  @include_actions
end

#outputObject

Returns the value of attribute output.



19
20
21
# File 'lib/brainstem/api_docs/formatters/open_api_specification/version_2/controller_formatter.rb', line 19

def output
  @output
end

Instance Method Details

#callObject



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

def call
  return {} if controller.nodoc?

  format_actions!
end

#valid_optionsObject

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



13
14
15
16
17
# File 'lib/brainstem/api_docs/formatters/open_api_specification/version_2/controller_formatter.rb', line 13

def valid_options
  super | [
    :include_actions
  ]
end