class Brainstem::ApiDocs::Formatters::Markdown::EndpointCollectionFormatter

Attributes

endpoint_collection[RW]
output[RW]
zero_text[RW]

Public Class Methods

new(endpoint_collection, options = {}) click to toggle source

Public API

# File lib/brainstem/api_docs/formatters/markdown/endpoint_collection_formatter.rb, line 18
def initialize(endpoint_collection, options = {})
  self.endpoint_collection = endpoint_collection
  self.output              = ""
  self.zero_text           = "No endpoints were found."

  super options
end

Public Instance Methods

call() click to toggle source
# File lib/brainstem/api_docs/formatters/markdown/endpoint_collection_formatter.rb, line 34
def call
  format_endpoints!
  format_zero_text! if output.empty?
  output
end
valid_options() click to toggle source
# File lib/brainstem/api_docs/formatters/markdown/endpoint_collection_formatter.rb, line 30
def valid_options
  super | [ :zero_text ]
end

Private Instance Methods

all_formatted_endpoints() click to toggle source
# File lib/brainstem/api_docs/formatters/markdown/endpoint_collection_formatter.rb, line 44
def all_formatted_endpoints
  endpoint_collection
    .only_documentable
    .formatted(:markdown)
    .reject(&:empty?)
end
format_endpoints!() click to toggle source
# File lib/brainstem/api_docs/formatters/markdown/endpoint_collection_formatter.rb, line 51
def format_endpoints!
  output << all_formatted_endpoints.join(md_hr)
end
format_zero_text!() click to toggle source
# File lib/brainstem/api_docs/formatters/markdown/endpoint_collection_formatter.rb, line 55
def format_zero_text!
  output << zero_text
end