Sha256: 3be9b3179e32be79b04114aa8007c287df2cd13b4914f8f9f94daa0b5c9d4d59

Contents?: true

Size: 559 Bytes

Versions: 2

Compression:

Stored size: 559 Bytes

Contents

module GrapeSlate
  class Document < GrapeMarkdown::Document
    attr_reader :shell_template

    def initialize(api_class)
      super

      @shell_template = template_for(:shell)
    end

    def shell_example(route, resource)
      example = ExampleGenerator::Shell.new(route, resource)

      render(shell_template, example.example_binding)
    end

    private

    def template_for(name)
      directory = File.dirname(File.expand_path(__FILE__))
      path = File.join(directory, "./templates/#{name}.md.erb")

      File.read(path)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
grape-slate-0.0.3 lib/grape-slate/document.rb
grape-slate-0.0.2 lib/grape-slate/document.rb