Sha256: 991a9ef1a33e213f6d5c576414c02d73ab86a7ef7c6b316986ea8f8fda1d8ef8

Contents?: true

Size: 900 Bytes

Versions: 1

Compression:

Stored size: 900 Bytes

Contents

module BloodContracts
  class Suite
    extend Dry::Initializer

    option :data_generator, optional: true
    option :contract, default: -> { Hashie::Mash.new }
    option :input_writer, optional: true
    option :output_writer, optional: true
    option :storage_backend, optional: true
    option :storage, default: -> { default_storage }

    def data_generator=(generator)
      fail ArgumentError unless generator.respond_to?(:call)
      @data_generator = generator
    end

    def contract=(contract)
      fail ArgumentError unless contract.respond_to?(:to_h)
      @contract = Hashie::Mash.new(contract.to_h)
    end

    def input_writer=(writer)
      storage.input_writer = writer
    end

    def output_writer=(writer)
      storage.output_writer = writer
    end

    def default_storage
      Storage.new(input_writer: input_writer, output_writer: output_writer)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blood_contracts-0.1.0 lib/blood_contracts/suite.rb