Sha256: 84b92a8eeb81a90cd854b6a2a2c417b80d48c19b45b27e5f9cec760653122955

Contents?: true

Size: 756 Bytes

Versions: 4

Compression:

Stored size: 756 Bytes

Contents

# encoding: utf-8

module Attestor

  module Policy

    # XOR-concatenation of several policies (branches)
    #
    # The policy is valid when it has both valid and invalid branches.
    #
    # @example (see #validate)
    #
    # @api private
    class Xor < Node

      # Checks whether both valid and invalid branches are present
      #
      # @example
      #   first.valid?  # => true
      #   second.valid? # => true
      #
      #   composition = Attestor::Policy::Xor.new(first, second)
      #   composition.validate
      #   # => Policy::InvalidError
      #
      # @return [undefined]
      def validate
        return if any_valid? && any_invalid?
        super
      end

    end # class Xor

  end # module Base

end # module Policy

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
attestor-0.3.0 lib/attestor/policy/xor.rb
attestor-0.2.0 lib/attestor/policy/xor.rb
attestor-0.1.0 lib/attestor/policy/xor.rb
attestor-0.0.1 lib/attestor/policy/xor.rb