Class: Attestor::Policy::Node
- Inherits:
-
Object
- Object
- Attestor::Policy::Node
- Includes:
- Attestor::Policy, Enumerable
- Defined in:
- lib/attestor/policy/node.rb
Instance Attribute Summary collapse
-
#branches ⇒ Object
readonly
Returns the value of attribute branches.
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(*branches) ⇒ Node
constructor
A new instance of Node.
- #validate! ⇒ Object
Methods included from Attestor::Policy
#and, included, new, #not, #or, #xor
Methods included from Validations::ClassMethods
#validate, #validates, #validations, #validators
Methods included from Factory
Methods included from Validations
Constructor Details
#initialize(*branches) ⇒ Node
Returns a new instance of Node.
13 14 15 16 |
# File 'lib/attestor/policy/node.rb', line 13 def initialize(*branches) @branches = branches.flatten freeze end |
Instance Attribute Details
#branches ⇒ Object (readonly)
Returns the value of attribute branches.
11 12 13 |
# File 'lib/attestor/policy/node.rb', line 11 def branches @branches end |
Instance Method Details
#each ⇒ Object
22 23 24 |
# File 'lib/attestor/policy/node.rb', line 22 def each block_given? ? branches.each { |item| yield(item.validate) } : to_enum end |
#validate! ⇒ Object
18 19 20 |
# File 'lib/attestor/policy/node.rb', line 18 def validate! invalid :base end |