module Dictum

Constants

MISSING_MESSAGE
TEMPFILE_PATH
VERSION

Public Class Methods

config() click to toggle source
# File lib/dictum.rb, line 60
def self.config
  @config
end
configure() { |self| ... } click to toggle source
# File lib/dictum.rb, line 24
def self.configure
  yield self
end
document() click to toggle source

Method that will execute tests and then save the results in the selected format

# File lib/dictum.rb, line 89
def self.document
  Dir.mkdir(@config[:output_path]) unless Dir.exist?(@config[:output_path])
  Documenter.instance.reset_data

  system "bundle exec rspec #{@config[:root_path]} --tag dictum" if @config[:test_suite] == :rspec

  save_to_file
end
endpoint(arguments) click to toggle source

Method used to create a new endpoint of a resource

# File lib/dictum.rb, line 74
def self.endpoint(arguments)
  Documenter.instance.endpoint(arguments)
end
error_codes(codes_list) click to toggle source

Method used to add a new error code. @param codes_list is an array of hashes representing the code, message and description

# File lib/dictum.rb, line 82
def self.error_codes(codes_list)
  codes_list.each { |error| Documenter.instance.error_code(error) }
end
header_title=(title) click to toggle source
# File lib/dictum.rb, line 52
def self.header_title=(title)
  @config[:header_title] = title
end
index_title=(title) click to toggle source
# File lib/dictum.rb, line 48
def self.index_title=(title)
  @config[:index_title] = title
end
inline_css=(style) click to toggle source
# File lib/dictum.rb, line 56
def self.inline_css=(style)
  @config[:inline_css] = style
end
output_filename=(file) click to toggle source
# File lib/dictum.rb, line 44
def self.output_filename=(file)
  @config[:output_filename] = file
end
output_format=(style) click to toggle source
# File lib/dictum.rb, line 28
def self.output_format=(style)
  @config[:output_format] = style
end
output_path=(folder) click to toggle source
# File lib/dictum.rb, line 32
def self.output_path=(folder)
  @config[:output_path] = folder
end
resource(arguments) click to toggle source

Method used to create a new resource

# File lib/dictum.rb, line 67
def self.resource(arguments)
  Documenter.instance.resource(arguments)
end
root_path=(folder) click to toggle source
# File lib/dictum.rb, line 36
def self.root_path=(folder)
  @config[:root_path] = folder
end
save_to_file() click to toggle source
# File lib/dictum.rb, line 98
def self.save_to_file
  writer = nil
  output_filename = "#{@config[:output_path]}/#{@config[:output_filename]}"

  case @config[:output_format]
  when :markdown
    writer = MarkdownWriter.new(output_filename, TEMPFILE_PATH, @config)
  when :html
    writer = HtmlWriter.new(output_filename, TEMPFILE_PATH, @config)
  end

  writer.write
end
test_suite=(suite) click to toggle source
# File lib/dictum.rb, line 40
def self.test_suite=(suite)
  @config[:test_suite] = suite
end