Class: Pact::Doc::DocFile
- Inherits:
-
Object
- Object
- Pact::Doc::DocFile
- Defined in:
- lib/pact/doc/doc_file.rb
Instance Method Summary collapse
-
#initialize(consumer_contract, dir, consumer_contract_renderer, file_extension) ⇒ DocFile
constructor
A new instance of DocFile.
- #name ⇒ Object
- #title ⇒ Object
- #write ⇒ Object
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
#name ⇒ Object
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 |
#title ⇒ Object
16 17 18 |
# File 'lib/pact/doc/doc_file.rb', line 16 def title consumer_contract.provider.name end |
#write ⇒ Object
12 13 14 |
# File 'lib/pact/doc/doc_file.rb', line 12 def write File.open(path, "w") { |io| io << doc_file_contents } end |