class Fictium::ApiBlueprintExporter::ActionFormatter

Protected Instance Methods

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

Private Instance Methods

build_examples(action) click to toggle source
# File lib/fictium/exporters/api_blueprint_exporter/action_formatter.rb, line 18
def build_examples(action)
  default_example = action.default_example
  examples = action.examples.reject { |example| example == default_example }
  sections = ([default_example] + examples).map do |example|
    example_formatter.format(example)
  end
  join_sections(sections)
end
build_header(action) click to toggle source
# File lib/fictium/exporters/api_blueprint_exporter/action_formatter.rb, line 12
def build_header(action)
  result = "## #{action.summary} [#{action.method.to_s.upcase} #{action.path}]"
  description = action.description.present? ? "\n\n#{action.description}\n" : ''
  "#{result}#{description}"
end
example_formatter() click to toggle source
# File lib/fictium/exporters/api_blueprint_exporter/action_formatter.rb, line 27
def example_formatter
  @example_formatter ||= ExampleFormatter.new
end