Class: Granite::Action::Policies::AnyStrategy

Inherits:
Object
  • Object
show all
Defined in:
lib/granite/action/policies/any_strategy.rb

Overview

Granite BA policy which allows action to be performed if at least one defined policy evaluates to true

Direct Known Subclasses

RequiredPerformerStrategy

Class Method Summary collapse

Class Method Details

.allowed?(action) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/granite/action/policies/any_strategy.rb', line 6

def self.allowed?(action)
  action._policies.any? { |policy| action.instance_exec(action.performer, &policy) }
end