Class: Pact::Doc::DocFile

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

Instance Method Summary collapse

Constructor Details

#initialize(consumer_contract, dir, consumer_contract_renderer, file_extension) ⇒ DocFile

Returns a new instance of DocFile.



5
6
7
8
9
10
# File 'lib/pact/doc/doc_file.rb', line 5

def initialize consumer_contract, dir, consumer_contract_renderer, file_extension
  @dir = dir
  @consumer_contract = consumer_contract
  @consumer_contract_renderer = consumer_contract_renderer
  @file_extension = file_extension
end

Instance Method Details

#nameObject



20
21
22
# File 'lib/pact/doc/doc_file.rb', line 20

def name
  "#{consumer_contract.consumer.name} - #{consumer_contract.provider.name}#{file_extension}"
end

#titleObject



16
17
18
# File 'lib/pact/doc/doc_file.rb', line 16

def title
  consumer_contract.provider.name
end

#writeObject



12
13
14
# File 'lib/pact/doc/doc_file.rb', line 12

def write
  File.open(path, "w") { |io|  io << doc_file_contents }
end