Class: Attestor::Policy::Node Private

Inherits:
Object
  • Object
show all
Includes:
Attestor::Policy, Enumerable
Defined in:
lib/attestor/policy/node.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.

The base class for composite policies

Direct Known Subclasses

And, Not, Or, Xor

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from Attestor::Policy

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

Methods included from Validations::ClassMethods

#validate, #validates, #validators

Methods included from Factory

#and, #not, #or, #xor

Methods included from Validations

included, #invalid, #validate

Class Attribute Details

.branchesArray<Policy::Base> (readonly)

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.

The branches of the node

Returns:

  • (Array<Policy::Base>)


32
33
34
# File 'lib/attestor/policy/node.rb', line 32

def branches
  @branches
end

Class Method Details

.eachEnumerator

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.

Iterates throught branches

Returns:

  • (Enumerator)


48
49
50
# File 'lib/attestor/policy/node.rb', line 48

def each
  block_given? ? branches.each { |item| yield(item) } : to_enum
end

.initialize(*branches) ⇒ 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.



23
24
25
26
# File 'lib/attestor/policy/node.rb', line 23

def initialize(*branches)
  @branches = branches.flatten
  freeze
end

.new(*branches) ⇒ Policy::Base::Node

Creates the node with branches

Parameters:

Returns:

  • (Policy::Base::Node)


# File 'lib/attestor/policy/node.rb', line 14

.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.

Validates the policy as invalid

To be reloaded by subclasses (And, Or, Xor, Not)

Returns:

  • (undefined)

Raises:

  • (Policy::InvalidError)


41
42
43
# File 'lib/attestor/policy/node.rb', line 41

def validate
  invalid :base
end