Class: Guardrails::Configuration::VisualDiffConfig

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initializeVisualDiffConfig

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

#adapterObject

Returns the value of attribute adapter.



49
50
51
# File 'lib/guardrails/configuration.rb', line 49

def adapter
  @adapter
end

#backstop_jsonObject

Returns the value of attribute backstop_json.



49
50
51
# File 'lib/guardrails/configuration.rb', line 49

def backstop_json
  @backstop_json
end

#enabledObject

Returns the value of attribute enabled.



49
50
51
# File 'lib/guardrails/configuration.rb', line 49

def enabled
  @enabled
end

#snap_diff_dirObject

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

#thresholdObject

Returns the value of attribute threshold.



49
50
51
# File 'lib/guardrails/configuration.rb', line 49

def threshold
  @threshold
end