Sha256: 01cf5ae6bf7f2e9bf628ec6f046811f8ff5f74264111f7ea0a4c37aff7f168b6

Contents?: true

Size: 994 Bytes

Versions: 1

Compression:

Stored size: 994 Bytes

Contents

# frozen_string_literal: true

module BCDD
  class Process
    module Output
      # :nodoc:
      class Properties
        attr_reader :success

        def initialize
          @success = {}
          @failure = {}
        end

        def success=(spec)
          @success = spec.transform_values(&BCDD::Contract)
        end

        def failure=(spec)
          @failure = spec.transform_values(&BCDD::Contract)
        end

        INVALID_INPUT = { invalid_input: ::Hash }.freeze

        def failure
          INVALID_INPUT.merge(@failure)
        end
      end

      class Evaluator
        # :nodoc:
        attr_reader :__properties__

        def initialize
          @__properties__ = Properties.new
        end

        private

        def Success(**spec)
          __properties__.success = spec
        end

        def Failure(**spec)
          __properties__.failure = spec
        end

        def contract
          ::BCDD::Contract
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bcdd-process-0.4.0 lib/bcdd/process/output.rb