Class: ValidateHTML::Configuration

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

Overview

Configuration attributes for ValidateHTML

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

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

#environmentsArray<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

Returns:

  • (Array<String>)


46
47
48
# File 'lib/validate_html/configuration.rb', line 46

def environments
  @environments
end

#ignored_errorsArray<String, Regexp>

Error messages to ignore

Returns:

  • (Array<String, Regexp>)


33
34
35
# File 'lib/validate_html/configuration.rb', line 33

def ignored_errors
  @ignored_errors
end

#ignored_pathsArray<String, Regexp>

App-relative paths to skip automatic validation

Returns:

  • (Array<String, Regexp>)


37
38
39
# File 'lib/validate_html/configuration.rb', line 37

def ignored_paths
  @ignored_paths
end

#raise_on_invalid_htmlBoolean 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_messagesBoolean Also known as: remember_messages?

Set to true to allow using ValidateHTML.raise_remembered_messages

Defaults to false

Returns:

  • (Boolean)

See Also:



28
29
30
# File 'lib/validate_html/configuration.rb', line 28

def remember_messages
  @remember_messages
end

#snapshot_pathPathname

The directory to use for snapshots with invalid HTML

Parameters:

  • path (Pathname, String)

Returns:

  • (Pathname)


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