Class: CautionTape::Configuration

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

Overview

Runtime configuration for the injected chrome.

Constant Summary collapse

STYLES =
%i[stripes solid].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



29
30
31
32
33
34
35
36
# File 'lib/caution_tape/configuration.rb', line 29

def initialize
  @enabled      = false
  @style        = :stripes
  @color        = "#f5c518"
  @banner       = nil
  @tag          = nil
  @border_width = 10
end

Instance Attribute Details

Full-width warning pill pinned top-center, e.g. "Sandbox — do not enter real data." nil renders no banner.



21
22
23
# File 'lib/caution_tape/configuration.rb', line 21

def banner
  @banner
end

#border_widthObject

Frame thickness in px.



27
28
29
# File 'lib/caution_tape/configuration.rb', line 27

def border_width
  @border_width
end

#colorObject

Accent color. Stripes pair it with near-black; solid uses it alone.



17
18
19
# File 'lib/caution_tape/configuration.rb', line 17

def color
  @color
end

#enabledObject

Whether any chrome is rendered at all. Defaults to off so production is safe by default — enable explicitly per environment.



10
11
12
# File 'lib/caution_tape/configuration.rb', line 10

def enabled
  @enabled
end

#styleObject

:stripes — diagonal caution stripes (accent color + black). :solid — a plain frame in the accent color.



14
15
16
# File 'lib/caution_tape/configuration.rb', line 14

def style
  @style
end

#tagObject

Small label pill (e.g. "Dev") shown when no banner is set. nil hides it.



24
25
26
# File 'lib/caution_tape/configuration.rb', line 24

def tag
  @tag
end