class Grape::App::Doc::Document

Attributes

endpoints[R]
entities[R]

Public Class Methods

new(api = Grape::App) click to toggle source
# File lib/grape/app/doc/document.rb, line 5
def initialize(api = Grape::App)
  registry   = Grape::App::Doc::Entity::Registry.new
  @endpoints = api.routes.map do |route|
    Grape::App::Doc::Endpoint.new(route, registry)
  end
  @entities  = registry.values
end

Public Instance Methods

output(template) click to toggle source

@param [String|Symbol] template path @return [String] output formatted as template

# File lib/grape/app/doc/document.rb, line 15
def output(template)
  template = File.expand_path("../templates/#{template}.erb") unless File.exist?(template)
  ERB.new(File.read(template), nil, '-').result(binding)
end