lib/attestor/policy/xor.rb in attestor-1.0.0 vs lib/attestor/policy/xor.rb in attestor-2.0.0
- old
+ new
@@ -2,30 +2,13 @@
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
+ # @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
+ def validate!
return if detect(&:valid?) && detect(&:invalid?)
super
end
end # class Xor