Class: AxeCuprite::Violation

Inherits:
Object
  • Object
show all
Defined in:
lib/axe/cuprite/results.rb

Overview

A single axe rule violation, with one or more offending nodes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw) ⇒ Violation

Returns a new instance of Violation.



78
79
80
# File 'lib/axe/cuprite/results.rb', line 78

def initialize(raw)
  @raw = DeepFreeze.call(raw || {})
end

Instance Attribute Details

#rawObject (readonly)

Returns the value of attribute raw.



76
77
78
# File 'lib/axe/cuprite/results.rb', line 76

def raw
  @raw
end

Instance Method Details

#color_contrast?Boolean

Returns:

  • (Boolean)


110
111
112
# File 'lib/axe/cuprite/results.rb', line 110

def color_contrast?
  id == "color-contrast"
end

#descriptionObject



90
91
92
# File 'lib/axe/cuprite/results.rb', line 90

def description
  @raw["description"]
end

#helpObject



94
95
96
# File 'lib/axe/cuprite/results.rb', line 94

def help
  @raw["help"]
end

#help_urlObject



98
99
100
# File 'lib/axe/cuprite/results.rb', line 98

def help_url
  @raw["helpUrl"]
end

#idObject



82
83
84
# File 'lib/axe/cuprite/results.rb', line 82

def id
  @raw["id"]
end

#impactObject



86
87
88
# File 'lib/axe/cuprite/results.rb', line 86

def impact
  @raw["impact"]
end

#nodesObject



106
107
108
# File 'lib/axe/cuprite/results.rb', line 106

def nodes
  @nodes ||= Array(@raw["nodes"]).map { |n| Node.new(n) }
end

#tagsObject



102
103
104
# File 'lib/axe/cuprite/results.rb', line 102

def tags
  Array(@raw["tags"])
end