Sha256: 886fd42691f808d16cf223ce9770619c75f89e9b4fb7f1b40790baa5915df7ab

Contents?: true

Size: 717 Bytes

Versions: 2

Compression:

Stored size: 717 Bytes

Contents

# encoding: utf-8

module Attestor

  module Policy

    # AND-concatenation of several policies (branches)
    #
    # The policy is valid if all its branches are valid.
    #
    # @example (see #validate)
    #
    # @api private
    class And < Node

      # Checks whether every policy is valid
      #
      # @example
      #   first.valid?  # => true
      #   second.valid? # => false
      #
      #   composition = Attestor::Policy::And.new(first, second)
      #   composition.validate
      #   # => Policy::InvalidError
      #
      # @return [undefined]
      def validate
        return unless detect(&:invalid?)
        super
      end

    end # class And

  end # module Base

end # module Policy

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
attestor-1.0.0 lib/attestor/policy/and.rb
attestor-0.4.0 lib/attestor/policy/and.rb