Module: CanCan::ConditionsMatcher

Included in:
Rule
Defined in:
lib/cancan/conditions_matcher.rb

Instance Method Summary collapse

Instance Method Details

#matches_conditions?(action, subject, extra_args) ⇒ Boolean

Matches the block or conditions hash

Returns:

  • (Boolean)


4
5
6
7
8
# File 'lib/cancan/conditions_matcher.rb', line 4

def matches_conditions?(action, subject, extra_args)
  return call_block_with_all(action, subject, extra_args) if @match_all
  return @block.call(subject, *extra_args) if @block && !subject_class?(subject)
  matches_non_block_conditions(subject)
end