Module: RSpecDocumentation

Defined in:
lib/rspec_documentation.rb,
lib/rspec_documentation/spec.rb,
lib/rspec_documentation/util.rb,
lib/rspec_documentation/rspec.rb,
lib/rspec_documentation/summary.rb,
lib/rspec_documentation/document.rb,
lib/rspec_documentation/page_tree.rb,
lib/rspec_documentation/formatters.rb,
lib/rspec_documentation/html_element.rb,
lib/rspec_documentation/configuration.rb,
lib/rspec_documentation/documentation.rb,
lib/rspec_documentation/rspec/failure.rb,
lib/rspec_documentation/formatters/xml.rb,
lib/rspec_documentation/formatters/ansi.rb,
lib/rspec_documentation/formatters/html.rb,
lib/rspec_documentation/formatters/json.rb,
lib/rspec_documentation/formatters/ruby.rb,
lib/rspec_documentation/formatters/yaml.rb,
lib/rspec_documentation/page_collection.rb,
lib/rspec_documentation/parsed_document.rb,
lib/rspec_documentation/javascript_bundle.rb,
lib/rspec_documentation/page_tree_element.rb,
lib/rspec_documentation/stylesheet_bundle.rb,
lib/rspec_documentation/project_initialization.rb

Overview

Internal module used by RSpec::Documentation to run examples and write output into an HTML document.

Defined Under Namespace

Modules: Formatters, RSpec Classes: Configuration, Document, Documentation, Error, HtmlElement, JavascriptBundle, MissingFileError, PageCollection, PageTree, PageTreeElement, ParsedDocument, ProjectInitialization, Spec, StylesheetBundle, Summary, Util

Class Method Summary collapse

Class Method Details

.configurationObject



74
75
76
# File 'lib/rspec_documentation.rb', line 74

def self.configuration
  @configuration ||= RSpecDocumentation::Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



70
71
72
# File 'lib/rspec_documentation.rb', line 70

def self.configure
  yield configuration
end

.context {|configuration.context| ... } ⇒ Object



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

def self.context
  yield configuration.context if block_given?
  configuration.context
end

.hook(name) ⇒ Object



61
62
63
# File 'lib/rspec_documentation.rb', line 61

def self.hook(name)
  configuration.hooks.fetch(name, nil)&.call
end

.rootObject



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

def self.root
  Pathname.new(File.dirname(__dir__))
end

.template(name, format = :html) ⇒ Object



50
51
52
53
54
55
# File 'lib/rspec_documentation.rb', line 50

def self.template(name, format = :html)
  ERB.new(
    root.join('lib/templates', "#{name}.#{format}.erb").read,
    eoutvar: "@eout#{SecureRandom.hex(16)}"
  )
end

.theme(name) ⇒ Object



57
58
59
# File 'lib/rspec_documentation.rb', line 57

def self.theme(name)
  ERB.new(root.join('lib/templates/themes', "#{name}.css").read).result(binding)
end