Class: Attestor::Policy::Negator Private
- Inherits:
-
Object
- Object
- Attestor::Policy::Negator
- Defined in:
- lib/attestor/policy/negator.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.
Composes a policy with an argument of its #not method
Instance Attribute Summary collapse
-
#composer ⇒ Class
readonly
private
The the composer for policies.
-
#policy ⇒ Policy::Base
readonly
private
The the policy to be composed with negations of other policies.
Class Method Summary collapse
-
.initialize(composer, policy) ⇒ Policy::Base::Negator
private
Creates the negator object, expecting #not method call.
Instance Method Summary collapse
-
#new(policy, composer) ⇒ Policy::Base::Negator
Creates the negator object, expecting #not method call.
-
#not(*policies) ⇒ Policy::Base
private
Returns a composition of the #policy with negations of other policies.
Instance Attribute Details
#composer ⇒ Class (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 the composer for policies
47 48 49 |
# File 'lib/attestor/policy/negator.rb', line 47 def composer @composer end |
#policy ⇒ 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 the policy to be composed with negations of other policies
41 42 43 |
# File 'lib/attestor/policy/negator.rb', line 41 def policy @policy end |
Class Method Details
.initialize(composer, policy) ⇒ Policy::Base::Negator
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.
Creates the negator object, expecting #not method call
22 23 24 25 26 |
# File 'lib/attestor/policy/negator.rb', line 22 def initialize(composer, policy) @policy = policy @composer = composer freeze end |
Instance Method Details
#new(policy, composer) ⇒ Policy::Base::Negator
Creates the negator object, expecting #not method call
22 23 24 25 26 |
# File 'lib/attestor/policy/negator.rb', line 22 def initialize(composer, policy) @policy = policy @composer = composer freeze end |
#not(*policies) ⇒ Policy::Base
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.
Returns a composition of the #policy with negations of other policies
33 34 35 |
# File 'lib/attestor/policy/negator.rb', line 33 def not(*policies) composer.new policy, policies.flat_map(&Not.method(:new)) end |