Class: Attestor::Policy::Negator

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(composer, policy) ⇒ Negator

Returns a new instance of Negator.



10
11
12
13
14
# File 'lib/attestor/policy/negator.rb', line 10

def initialize(composer, policy)
  @policy   = policy
  @composer = composer
  freeze
end

Instance Attribute Details

#composerObject (readonly)

Returns the value of attribute composer.



20
21
22
# File 'lib/attestor/policy/negator.rb', line 20

def composer
  @composer
end

#policyObject (readonly)

Returns the value of attribute policy.



20
21
22
# File 'lib/attestor/policy/negator.rb', line 20

def policy
  @policy
end

Instance Method Details

#not(*policies) ⇒ Object



16
17
18
# File 'lib/attestor/policy/negator.rb', line 16

def not(*policies)
  composer.new policy, policies.flat_map(&Not.method(:new))
end