Module: IIPolicy::Lookup

Extended by:
ActiveSupport::Concern
Included in:
Base
Defined in:
lib/ii_policy/lookup.rb

Class Method Summary collapse

Class Method Details

.call(klass) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/ii_policy/lookup.rb', line 17

def call(klass)
  klass = klass.class unless klass.is_a?(Module)
  return if terminate?(klass)

  with_cache(klass) do
    if klass.name && (policy = resolve(klass))
      policy
    elsif klass.superclass
      call(klass.superclass)
    end
  end
end