Class: Passpartu::BlockVerify

Inherits:
Verify
  • Object
show all
Defined in:
lib/passpartu/block_verify.rb

Defined Under Namespace

Classes: BlockMissedError

Constant Summary collapse

MAYBE_VALUE =
'maybe'

Constants inherited from Verify

Verify::CRUD_KEY

Instance Attribute Summary

Attributes inherited from Verify

#block, #except, #keys, #only, #policy_hash, #result, #role

Instance Method Summary collapse

Methods inherited from Verify

call, #initialize

Constructor Details

This class inherits a constructor from Passpartu::Verify

Instance Method Details

#callObject

Raises:



8
9
10
11
12
13
14
# File 'lib/passpartu/block_verify.rb', line 8

def call
  policy_result = super
  raise BlockMissedError, "Block is required for 'maybe' allowed resource" if maybe? && block.nil?
  return policy_result if block.nil?

  policy_result && block.call
end