Method: ActionPolicy::Policy::PreCheck::Check#initialize
- Defined in:
- lib/action_policy/policy/pre_check.rb
#initialize(policy, name, except: nil, only: nil) ⇒ Check
Returns a new instance of Check.
64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/action_policy/policy/pre_check.rb', line 64 def initialize(policy, name, except: nil, only: nil) if !except.nil? && !only.nil? raise ArgumentError, "Only one of `except` and `only` may be specified for pre-check" end @policy_class = policy @name = name @blacklist = Array(except) unless except.nil? @whitelist = Array(only) unless only.nil? rebuild_filter end |