class ApiBlueprintFormatter::BaseFormatter

Base for other formatters, providing utility methods

Protected Instance Methods

indent_lines(number_of_spaces, string) click to toggle source
# File lib/api_blueprint/base_formatter.rb, line 6
def indent_lines(number_of_spaces, string)
  string
    .split("\n")
    .map { |a| a.prepend(' ' * number_of_spaces) }
    .join("\n")
end
sanitize_api_identifier(name) click to toggle source

Change certain characters that might come up in example names but do not play well with the API specs. Example: 'Test for [value]' -> 'Test for {value}'

# File lib/api_blueprint/base_formatter.rb, line 16
def sanitize_api_identifier(name)
  name.gsub(/[\[\]]/, '[' => '{', ']' => '}')
end