class ActionDispatch::ContentSecurityPolicy

def build_directives(context, nonce, nonce_directives)

def build_directives(context, nonce, nonce_directives)
  @directives.map do |directive, sources|
    if sources.is_a?(Array)
      if nonce && nonce_directive?(directive, nonce_directives)
        "#{directive} #{build_directive(sources, context).join(' ')} 'nonce-#{nonce}'"
      else
        "#{directive} #{build_directive(sources, context).join(' ')}"
      end
    elsif sources
      directive
    else
      nil
    end
  end
end