Module: Dictum

Defined in:
lib/dictum.rb,
lib/dictum/version.rb,
lib/dictum/documenter.rb,
lib/dictum/html_writer.rb,
lib/dictum/html_helpers.rb,
lib/dictum/markdown_writer.rb

Defined Under Namespace

Classes: Documenter, HtmlHelpers, HtmlWriter, MarkdownWriter

Constant Summary collapse

VERSION =
'0.0.5'.freeze

Class Method Summary collapse

Class Method Details

.configObject



58
59
60
# File 'lib/dictum.rb', line 58

def self.config
  @config
end

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Dictum)

    the object that the method was called on



22
23
24
# File 'lib/dictum.rb', line 22

def self.configure
  yield self
end

.documentObject

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



79
80
81
82
83
84
85
86
# File 'lib/dictum.rb', line 79

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]}" if @config[:test_suite] == :rspec

  save_to_file
end

.endpoint(arguments) ⇒ Object

Method used to create a new endpoint of a resource



72
73
74
# File 'lib/dictum.rb', line 72

def self.endpoint(arguments)
  Documenter.instance.endpoint(arguments)
end

.header_title=(title) ⇒ Object



50
51
52
# File 'lib/dictum.rb', line 50

def self.header_title=(title)
  @config[:header_title] = title
end

.index_title=(title) ⇒ Object



46
47
48
# File 'lib/dictum.rb', line 46

def self.index_title=(title)
  @config[:index_title] = title
end

.inline_css=(style) ⇒ Object



54
55
56
# File 'lib/dictum.rb', line 54

def self.inline_css=(style)
  @config[:inline_css] = style
end

.output_filename=(file) ⇒ Object



42
43
44
# File 'lib/dictum.rb', line 42

def self.output_filename=(file)
  @config[:output_filename] = file
end

.output_format=(style) ⇒ Object



26
27
28
# File 'lib/dictum.rb', line 26

def self.output_format=(style)
  @config[:output_format] = style
end

.output_path=(folder) ⇒ Object



30
31
32
# File 'lib/dictum.rb', line 30

def self.output_path=(folder)
  @config[:output_path] = folder
end

.resource(arguments) ⇒ Object

Method used to create a new resource



65
66
67
# File 'lib/dictum.rb', line 65

def self.resource(arguments)
  Documenter.instance.resource(arguments)
end

.root_path=(folder) ⇒ Object



34
35
36
# File 'lib/dictum.rb', line 34

def self.root_path=(folder)
  @config[:root_path] = folder
end

.save_to_fileObject



88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/dictum.rb', line 88

def self.save_to_file
  writer = nil
  output_filename = "#{@config[:output_path]}/#{@config[:output_filename]}"
  tempfile_path = Documenter.instance.tempfile_path

  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) ⇒ Object



38
39
40
# File 'lib/dictum.rb', line 38

def self.test_suite=(suite)
  @config[:test_suite] = suite
end