Class: Attestor::Policy::Not Private

Inherits:
Node
  • Object
show all
Defined in:
lib/attestor/policy/not.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Negation of a single policy

The policy is valid if its only branch is invalid

Instance Attribute Summary

Attributes included from Attestor::Policy

#attributes, #block

Class Method Summary collapse

Methods included from Attestor::Policy

#and, included, #invalid?, #not, #or, #valid?, #xor

Methods included from Validations::ClassMethods

#follow_policy, #validate, #validators

Methods included from Factory

#and, #not, #or, #xor

Methods included from Validations

included, #invalid, #validate

Class Method Details

.initialize(_) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



25
26
27
# File 'lib/attestor/policy/not.rb', line 25

def initialize(_)
  super
end

.new(policy) ⇒ Policy::Base::Node

Creates the policy negation

Parameters:

  • policy (Array<Policy::Base>)

Returns:

  • (Policy::Base::Node)


# File 'lib/attestor/policy/not.rb', line 16

.validateundefined

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Checks whether every policy is valid

Examples:

policy.valid? # => true

composition = Attestor::Policy::Not.new(policy)
composition.validate
# => Policy::InvalidError

Returns:

  • (undefined)


39
40
41
42
# File 'lib/attestor/policy/not.rb', line 39

def validate
  return unless any_valid?
  super
end