Module: CanCan::ConditionsMatcher

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

Instance Method Summary collapse

Instance Method Details

#matches_conditions?(action, subject, attribute = nil, *extra_args) ⇒ Boolean

Matches the block or conditions hash

Returns:

  • (Boolean)


6
7
8
9
10
11
12
# File 'lib/cancan/conditions_matcher.rb', line 6

def matches_conditions?(action, subject, attribute = nil, *extra_args)
  return call_block_with_all(action, subject, extra_args) if @match_all
  return matches_block_conditions(subject, attribute, *extra_args) if @block
  return matches_non_block_conditions(subject) unless conditions_empty?

  true
end