class ActionDispatch::PermissionsPolicy

def resolve_source(source, context)

def resolve_source(source, context)
  case source
  when String
    source
  when Symbol
    source.to_s
  when Proc
    if context.nil?
      raise RuntimeError, "Missing context for the dynamic permissions policy source: #{source.inspect}"
    else
      context.instance_exec(&source)
    end
  else
    raise RuntimeError, "Unexpected permissions policy source: #{source.inspect}"
  end
end