Class: Rack::ContentSecurityPolicy::DirectiveKey

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/content_security_policy/contracts.rb

Overview

Custom Contracts See : egonschiele.github.io/contracts.ruby/

Class Method Summary collapse

Class Method Details

.to_sObject



11
12
13
# File 'lib/rack/content_security_policy/contracts.rb', line 11

def self.to_s
  'A CSP directive key must be one or more lowercase ASCII (a-z) characters with optional dashes (-)'
end

.valid?(val) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/rack/content_security_policy/contracts.rb', line 7

def self.valid?(val)
  Contract.valid?(val, /^[[a-z]+\-?]+$/)
end