class Fictium::ApiBlueprintExporter::ResourceFormatter

Protected Instance Methods

format_sections(resource) click to toggle source
# File lib/fictium/exporters/api_blueprint_exporter/resource_formatter.rb, line 6
def format_sections(resource)
  [build_header(resource), build_actions(resource)]
end

Private Instance Methods

action_formatter() click to toggle source
# File lib/fictium/exporters/api_blueprint_exporter/resource_formatter.rb, line 26
def action_formatter
  @action_formatter ||= ActionFormatter.new
end
build_actions(resource) click to toggle source
# File lib/fictium/exporters/api_blueprint_exporter/resource_formatter.rb, line 19
def build_actions(resource)
  sections = resource.actions.map do |action|
    action_formatter.format(action)
  end
  join_sections(sections)
end
build_header(resource) click to toggle source
# File lib/fictium/exporters/api_blueprint_exporter/resource_formatter.rb, line 12
def build_header(resource)
  header = "# #{resource.name&.pluralize&.humanize} [#{resource.base_path}]"
  header += "\n#{resource.summary.capitalize}\n" if resource.summary.present?
  description = resource.description.present? ? "\n#{resource.description}\n" : ''
  "#{header}#{description}"
end