class GrapeSlate::Document

Attributes

shell_template[R]

Public Class Methods

new(api_class) click to toggle source
Calls superclass method
# File lib/grape-slate/document.rb, line 5
def initialize(api_class)
  super

  @shell_template = template_for(:shell)
end

Public Instance Methods

shell_example(route, resource) click to toggle source
# File lib/grape-slate/document.rb, line 11
def shell_example(route, resource)
  example = ExampleGenerator::Shell.new(route, resource)

  render(shell_template, example.example_binding)
end

Private Instance Methods

template_for(name) click to toggle source
# File lib/grape-slate/document.rb, line 19
def template_for(name)
  directory = File.dirname(File.expand_path(__FILE__))

  File.read(File.join(directory, "./templates/#{name}.md.erb"))
end