Class: Biscuit::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/biscuit/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/biscuit/configuration.rb', line 33

def initialize
  @categories = {
    necessary:  { required: true },
    analytics:  { required: false },
    marketing:  { required: false }
  }
  @cookie_name         = "biscuit_consent"
  @cookie_expires_days = 365
  @cookie_path         = "/"
  @cookie_domain       = nil
  @cookie_same_site    = "Lax"
  @position            = :bottom
  @privacy_policy_url  = "#"
end

Instance Attribute Details

#categoriesObject

Cookie categories. Each key is the category identifier (symbol). :necessary is always present and always true — cannot be disabled by the user. Additional categories are shown to the user and default to opt-out. Each category accepts:

required: true/false  — if true, shown as disabled/checked in the UI


8
9
10
# File 'lib/biscuit/configuration.rb', line 8

def categories
  @categories
end

Cookie domain. nil means current domain. Default: nil



22
23
24
# File 'lib/biscuit/configuration.rb', line 22

def cookie_domain
  @cookie_domain
end

Consent cookie lifetime in days. Default: 365



16
17
18
# File 'lib/biscuit/configuration.rb', line 16

def cookie_expires_days
  @cookie_expires_days
end

Name of the browser cookie storing consent state. Default: “biscuit_consent”



12
13
14
# File 'lib/biscuit/configuration.rb', line 12

def cookie_name
  @cookie_name
end

Cookie path. Default: “/”



19
20
21
# File 'lib/biscuit/configuration.rb', line 19

def cookie_path
  @cookie_path
end

SameSite attribute. Default: “Lax”



25
26
27
# File 'lib/biscuit/configuration.rb', line 25

def cookie_same_site
  @cookie_same_site
end

#positionObject

Banner position: :bottom or :top. Default: :bottom



28
29
30
# File 'lib/biscuit/configuration.rb', line 28

def position
  @position
end

#privacy_policy_urlObject

URL for the “Learn more” / privacy policy link. Default: “#”



31
32
33
# File 'lib/biscuit/configuration.rb', line 31

def privacy_policy_url
  @privacy_policy_url
end