Sha256: 838ddd0d85fc5704efaff276c52ff229cf0e490850b9d8466dc3c82131623495

Contents?: true

Size: 874 Bytes

Versions: 35

Compression:

Stored size: 874 Bytes

Contents

module Pact
  module Doc
    class DocFile

      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

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

      def title
        consumer_contract.provider.name
      end

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

      private

      attr_reader :dir, :consumer_contract, :consumer_contract_renderer, :file_extension


      def path
        File.join(dir, name)
      end

      def doc_file_contents
        consumer_contract_renderer.call(consumer_contract)
      end

    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
pact_broker-2.34.0 lib/pact/doc/doc_file.rb
pact_broker-2.33.0 lib/pact/doc/doc_file.rb
pact_broker-2.32.0 lib/pact/doc/doc_file.rb
pact_broker-2.31.0 lib/pact/doc/doc_file.rb
pact_broker-2.30.0 lib/pact/doc/doc_file.rb
pact_broker-2.29.0 lib/pact/doc/doc_file.rb
pact_broker-2.27.6 lib/pact/doc/doc_file.rb
pact_broker-2.27.5 lib/pact/doc/doc_file.rb
pact_broker-2.27.4 lib/pact/doc/doc_file.rb
pact_broker-2.27.3 lib/pact/doc/doc_file.rb
pact_broker-2.27.2 lib/pact/doc/doc_file.rb
pact_broker-2.27.0 lib/pact/doc/doc_file.rb
pact_broker-2.26.1 lib/pact/doc/doc_file.rb
pact_broker-2.26.0 lib/pact/doc/doc_file.rb
pact_broker-2.25.0 lib/pact/doc/doc_file.rb
pact_broker-2.24.0 lib/pact/doc/doc_file.rb
pact_broker-2.23.4 lib/pact/doc/doc_file.rb
pact_broker-2.23.3 lib/pact/doc/doc_file.rb
pact_broker-2.23.2 lib/pact/doc/doc_file.rb
pact_broker-2.23.1 lib/pact/doc/doc_file.rb