Class: Pact::Doc::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/pact/doc/generator.rb

Direct Known Subclasses

Markdown::Generator

Instance Method Summary collapse

Constructor Details

#initialize(pact_dir, doc_dir, options) ⇒ Generator

Returns a new instance of Generator.



9
10
11
12
13
14
15
16
17
18
# File 'lib/pact/doc/generator.rb', line 9

def initialize pact_dir, doc_dir, options
  @doc_dir = doc_dir
  @pact_dir = pact_dir
  @consumer_contract_renderer = options[:consumer_contract_renderer]
  @doc_type = options[:doc_type]
  @file_extension = options[:file_extension]
  @index_renderer = options[:index_renderer]
  @index_name = options[:index_name]
  @after = options.fetch(:after, lambda{|pact_dir, target_dir, consumer_contracts| })
end

Instance Method Details

#callObject



20
21
22
23
24
25
# File 'lib/pact/doc/generator.rb', line 20

def call
  ensure_target_dir_exists_and_is_clean
  write_index if consumer_contracts.any?
  write_doc_files
  perform_after_hook
end