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.



71
72
73
# File 'lib/axe/cuprite/results.rb', line 71

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

Instance Attribute Details

#rawObject (readonly)

Returns the value of attribute raw.



69
70
71
# File 'lib/axe/cuprite/results.rb', line 69

def raw
  @raw
end

Instance Method Details

#color_contrast?Boolean

Returns:

  • (Boolean)


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

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

#descriptionObject



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

def description
  @raw["description"]
end

#helpObject



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

def help
  @raw["help"]
end

#help_urlObject



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

def help_url
  @raw["helpUrl"]
end

#idObject



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

def id
  @raw["id"]
end

#impactObject



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

def impact
  @raw["impact"]
end

#nodesObject



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

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

#tagsObject



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

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