Class: ValidateHTML::Configuration
- Inherits:
-
Object
- Object
- ValidateHTML::Configuration
- Defined in:
- lib/validate_html/configuration.rb
Overview
Configuration attributes for ValidateHTML
Instance Attribute Summary collapse
-
#environments ⇒ Array<String>
The rails environments to initialize automatic validation.
-
#ignored_errors ⇒ Array<String, Regexp>
Error messages to ignore.
-
#ignored_paths ⇒ Array<String, Regexp>
App-relative paths to skip automatic validation.
-
#raise_on_invalid_html ⇒ Boolean
(also: #raise_on_invalid_html?)
Set to false to not raise InvalidHTMLError by default.
-
#remember_messages ⇒ Boolean
(also: #remember_messages?)
Set to true to allow using raise_remembered_messages.
-
#snapshot_path ⇒ Pathname
The directory to use for snapshots with invalid HTML.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
48 49 50 51 52 53 54 55 |
# File 'lib/validate_html/configuration.rb', line 48 def initialize @raise_on_invalid_html = true @ignored_errors = [] @ignored_paths = [] @environments = %w[development test] @remember_messages = false @snapshot_path = nil end |
Instance Attribute Details
#environments ⇒ Array<String>
The rails environments to initialize automatic validation
Defaults to [“development”, “test”]
This won’t take any effect if changed after the app is initialized
46 47 48 |
# File 'lib/validate_html/configuration.rb', line 46 def environments @environments end |
#ignored_errors ⇒ Array<String, Regexp>
Error messages to ignore
33 34 35 |
# File 'lib/validate_html/configuration.rb', line 33 def ignored_errors @ignored_errors end |
#ignored_paths ⇒ Array<String, Regexp>
App-relative paths to skip automatic validation
37 38 39 |
# File 'lib/validate_html/configuration.rb', line 37 def ignored_paths @ignored_paths end |
#raise_on_invalid_html ⇒ Boolean Also known as: raise_on_invalid_html?
Set to false to not raise InvalidHTMLError by default
Defaults to true
19 20 21 |
# File 'lib/validate_html/configuration.rb', line 19 def raise_on_invalid_html @raise_on_invalid_html end |
#remember_messages ⇒ Boolean Also known as: remember_messages?
Set to true to allow using ValidateHTML.raise_remembered_messages
Defaults to false
28 29 30 |
# File 'lib/validate_html/configuration.rb', line 28 def @remember_messages end |
#snapshot_path ⇒ Pathname
The directory to use for snapshots with invalid HTML
66 67 68 |
# File 'lib/validate_html/configuration.rb', line 66 def snapshot_path @snapshot_path ||= defined?(::Rails) ? ::Rails.root.join('tmp/invalid_html') : ::Pathname.new(::Dir.mktmpdir) end |