Sha256: 88fd55ed9d004e328f7b1540b54d46f9b011e33c1b3e3cda3c21382a25de4be3

Contents?: true

Size: 874 Bytes

Versions: 113

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

113 entries across 113 versions & 1 rubygems

Version Path
pact-1.31.0 lib/pact/doc/doc_file.rb
pact-1.30.0 lib/pact/doc/doc_file.rb
pact-1.29.0 lib/pact/doc/doc_file.rb
pact-1.28.0 lib/pact/doc/doc_file.rb
pact-1.28.0.rc1 lib/pact/doc/doc_file.rb
pact-1.27.0 lib/pact/doc/doc_file.rb
pact-1.26.0 lib/pact/doc/doc_file.rb
pact-1.25.0 lib/pact/doc/doc_file.rb
pact-1.24.0 lib/pact/doc/doc_file.rb
pact-1.23.0 lib/pact/doc/doc_file.rb
pact-1.22.2 lib/pact/doc/doc_file.rb
pact-1.22.0 lib/pact/doc/doc_file.rb
pact-1.21.0 lib/pact/doc/doc_file.rb
pact-1.20.1 lib/pact/doc/doc_file.rb
pact-1.20.0 lib/pact/doc/doc_file.rb
pact-1.19.2 lib/pact/doc/doc_file.rb
pact-1.19.1 lib/pact/doc/doc_file.rb
pact-1.19.0 lib/pact/doc/doc_file.rb
pact-1.18.0 lib/pact/doc/doc_file.rb
pact-1.17.0 lib/pact/doc/doc_file.rb