Class: Brainstem::ApiDocs::Formatters::OpenApiSpecification::Version2::PresenterFormatter
- Inherits:
-
AbstractFormatter
- Object
- AbstractFormatter
- Brainstem::ApiDocs::Formatters::OpenApiSpecification::Version2::PresenterFormatter
- Includes:
- Helper
- Defined in:
- lib/brainstem/api_docs/formatters/open_api_specification/version_2/presenter_formatter.rb
Instance Attribute Summary collapse
-
#definition ⇒ Object
Returns the value of attribute definition.
-
#output ⇒ Object
Returns the value of attribute output.
-
#presented_class ⇒ Object
Returns the value of attribute presented_class.
-
#presenter ⇒ Object
Returns the value of attribute presenter.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(presenter, options = {}) ⇒ PresenterFormatter
constructor
A new instance of PresenterFormatter.
Methods included from Helper
#format_http_method, #format_sentence, #format_tag_name, #presenter_title, #type_and_format, #uncapitalize
Methods inherited from AbstractFormatter
Methods included from Concerns::Optional
Constructor Details
#initialize(presenter, options = {}) ⇒ PresenterFormatter
Returns a new instance of PresenterFormatter.
14 15 16 17 18 19 20 |
# File 'lib/brainstem/api_docs/formatters/open_api_specification/version_2/presenter_formatter.rb', line 14 def initialize(presenter, = {}) self.presenter = presenter self.definition = ActiveSupport::HashWithIndifferentAccess.new self.output = ActiveSupport::HashWithIndifferentAccess.new super end |
Instance Attribute Details
#definition ⇒ Object
Returns the value of attribute definition.
22 23 24 |
# File 'lib/brainstem/api_docs/formatters/open_api_specification/version_2/presenter_formatter.rb', line 22 def definition @definition end |
#output ⇒ Object
Returns the value of attribute output.
22 23 24 |
# File 'lib/brainstem/api_docs/formatters/open_api_specification/version_2/presenter_formatter.rb', line 22 def output @output end |
#presented_class ⇒ Object
Returns the value of attribute presented_class.
22 23 24 |
# File 'lib/brainstem/api_docs/formatters/open_api_specification/version_2/presenter_formatter.rb', line 22 def presented_class @presented_class end |
#presenter ⇒ Object
Returns the value of attribute presenter.
22 23 24 |
# File 'lib/brainstem/api_docs/formatters/open_api_specification/version_2/presenter_formatter.rb', line 22 def presenter @presenter end |
Instance Method Details
#call ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/brainstem/api_docs/formatters/open_api_specification/version_2/presenter_formatter.rb', line 27 def call return {} if presenter.nodoc? format_title! format_description! format_type! format_fields! sort_properties! output.merge!(presenter.target_class => definition.reject {|_, v| v.blank?}) end |