class ActionDispatch::ContentSecurityPolicy

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 content security policy source: #{source.inspect}"
    else
      resolved = context.instance_exec(&source)
      apply_mappings(Array.wrap(resolved))
    end
  else
    raise RuntimeError, "Unexpected content security policy source: #{source.inspect}"
  end
end