Class: Biscuit::Configuration
- Inherits:
-
Object
- Object
- Biscuit::Configuration
- Defined in:
- lib/biscuit/configuration.rb
Instance Attribute Summary collapse
-
#categories ⇒ Object
Cookie categories.
-
#cookie_domain ⇒ Object
Cookie domain.
-
#cookie_expires_days ⇒ Object
Consent cookie lifetime in days.
-
#cookie_name ⇒ Object
Name of the browser cookie storing consent state.
-
#cookie_path ⇒ Object
Cookie path.
-
#cookie_same_site ⇒ Object
SameSite attribute.
-
#position ⇒ Object
Banner position: :bottom or :top.
-
#privacy_policy_url ⇒ Object
URL for the “Learn more” / privacy policy link.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
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
#categories ⇒ Object
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 ⇒ Object
Cookie domain. nil means current domain. Default: nil
22 23 24 |
# File 'lib/biscuit/configuration.rb', line 22 def @cookie_domain end |
#cookie_expires_days ⇒ Object
Consent cookie lifetime in days. Default: 365
16 17 18 |
# File 'lib/biscuit/configuration.rb', line 16 def @cookie_expires_days end |
#cookie_name ⇒ Object
Name of the browser cookie storing consent state. Default: “biscuit_consent”
12 13 14 |
# File 'lib/biscuit/configuration.rb', line 12 def @cookie_name end |
#cookie_path ⇒ Object
Cookie path. Default: “/”
19 20 21 |
# File 'lib/biscuit/configuration.rb', line 19 def @cookie_path end |
#cookie_same_site ⇒ Object
SameSite attribute. Default: “Lax”
25 26 27 |
# File 'lib/biscuit/configuration.rb', line 25 def @cookie_same_site end |
#position ⇒ Object
Banner position: :bottom or :top. Default: :bottom
28 29 30 |
# File 'lib/biscuit/configuration.rb', line 28 def position @position end |
#privacy_policy_url ⇒ Object
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 |