class Rack::BlacklistCookies::Configuration
Configuration
defaults to an empty hash if it has not been set.
Attributes
request_blacklist[RW]
response_blacklist[RW]
Public Class Methods
new()
click to toggle source
# File lib/rack/blacklist_cookies/configuration.rb, line 8 def initialize @request_blacklist = {} @response_blacklist = {} end
Public Instance Methods
reset()
click to toggle source
# File lib/rack/blacklist_cookies/configuration.rb, line 13 def reset @request_blacklist = {} @response_blacklist = {} end
validate()
click to toggle source
rubocop:disable MethodLength
# File lib/rack/blacklist_cookies/configuration.rb, line 19 def validate [@request_blacklist, @response_blacklist].each do |blacklist| raise ConfigurationError, "Blacklist is not a hash" unless blacklist.is_a?(Hash) blacklist.each do |route, cookie_list| raise ConfigurationError, "Blacklist key is not a string" unless route.is_a?(String) raise ConfigurationError, "Blacklist value is not an array" unless cookie_list.is_a?(Array) raise ConfigurationError, "Blacklist key is not a URL path" unless route.start_with?("/") cookie_list.each do |cookie_name| raise ConfigurationError, "Blacklist cookie is not a valid name string" unless cookie_name.is_a?(String) end end end end