class Restspec::Docs::DocsRunner
Constants
- TEMPLATE_BY_EXTENSION
Public Instance Methods
generate_docs()
click to toggle source
# File lib/restspec/runners/docs/docs_runner.rb, line 16 def generate_docs require 'restspec' require config_file File.write(file, read_template(extension)) end
Private Instance Methods
config_file()
click to toggle source
# File lib/restspec/runners/docs/docs_runner.rb, line 44 def config_file Pathname.new(Dir.pwd).join('spec/api/restspec/restspec_config.rb') end
extension()
click to toggle source
# File lib/restspec/runners/docs/docs_runner.rb, line 32 def extension match = file.match(/\.[\w]+$/) raise NoValidExtensionError if match.blank? match[0] end
read_template(extension)
click to toggle source
# File lib/restspec/runners/docs/docs_runner.rb, line 25 def read_template(extension) template_file_name = "templates/#{template_name}" template_file = Pathname.new(File.dirname(__FILE__)).join(template_file_name) Tilt.new(template_file).render(TemplateContext.new) end
template_name()
click to toggle source
# File lib/restspec/runners/docs/docs_runner.rb, line 38 def template_name TEMPLATE_BY_EXTENSION.fetch(extension) do raise NoValidExtensionError end end