Class: Guardrails::Configuration::VisualDiffConfig
- Inherits:
-
Object
- Object
- Guardrails::Configuration::VisualDiffConfig
- Defined in:
- lib/guardrails/configuration.rb
Overview
Nested configuration for the visual-diff audit. Adapter selection determines which screenshot-tool output we ingest; per-adapter paths and a global threshold round it out.
Constant Summary collapse
- DEFAULT_ADAPTER =
Built-in defaults — kept here, not in env-var fallback logic, so a user reading the Configuration class can see “what does Guardrails ship with” without grepping rake tasks.
:snap_diff- DEFAULT_SNAP_DIFF_DIR =
"doc/screenshots"- DEFAULT_THRESHOLD =
any non-zero mismatch fails
0.0- KNOWN_ADAPTERS =
%i[snap_diff backstop].freeze
Instance Attribute Summary collapse
-
#adapter ⇒ Object
Returns the value of attribute adapter.
-
#backstop_json ⇒ Object
Returns the value of attribute backstop_json.
-
#enabled ⇒ Object
Returns the value of attribute enabled.
-
#snap_diff_dir ⇒ Object
Returns the value of attribute snap_diff_dir.
-
#threshold ⇒ Object
Returns the value of attribute threshold.
Instance Method Summary collapse
-
#initialize ⇒ VisualDiffConfig
constructor
A new instance of VisualDiffConfig.
Constructor Details
#initialize ⇒ VisualDiffConfig
Returns a new instance of VisualDiffConfig.
51 52 53 54 55 56 57 |
# File 'lib/guardrails/configuration.rb', line 51 def initialize @enabled = false # opt-in: visual baselines need deliberate setup @adapter = DEFAULT_ADAPTER @snap_diff_dir = DEFAULT_SNAP_DIFF_DIR @backstop_json = nil @threshold = DEFAULT_THRESHOLD end |
Instance Attribute Details
#adapter ⇒ Object
Returns the value of attribute adapter.
49 50 51 |
# File 'lib/guardrails/configuration.rb', line 49 def adapter @adapter end |
#backstop_json ⇒ Object
Returns the value of attribute backstop_json.
49 50 51 |
# File 'lib/guardrails/configuration.rb', line 49 def backstop_json @backstop_json end |
#enabled ⇒ Object
Returns the value of attribute enabled.
49 50 51 |
# File 'lib/guardrails/configuration.rb', line 49 def enabled @enabled end |
#snap_diff_dir ⇒ Object
Returns the value of attribute snap_diff_dir.
49 50 51 |
# File 'lib/guardrails/configuration.rb', line 49 def snap_diff_dir @snap_diff_dir end |
#threshold ⇒ Object
Returns the value of attribute threshold.
49 50 51 |
# File 'lib/guardrails/configuration.rb', line 49 def threshold @threshold end |