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.



49
50
51
# File 'lib/axe/cuprite/results.rb', line 49

def initialize(raw)
  @raw = raw || {}
end

Instance Attribute Details

#rawObject (readonly)

Returns the value of attribute raw.



47
48
49
# File 'lib/axe/cuprite/results.rb', line 47

def raw
  @raw
end

Instance Method Details

#color_contrast?Boolean

Returns:

  • (Boolean)


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

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

#descriptionObject



61
62
63
# File 'lib/axe/cuprite/results.rb', line 61

def description
  @raw["description"]
end

#helpObject



65
66
67
# File 'lib/axe/cuprite/results.rb', line 65

def help
  @raw["help"]
end

#help_urlObject



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

def help_url
  @raw["helpUrl"]
end

#idObject



53
54
55
# File 'lib/axe/cuprite/results.rb', line 53

def id
  @raw["id"]
end

#impactObject



57
58
59
# File 'lib/axe/cuprite/results.rb', line 57

def impact
  @raw["impact"]
end

#nodesObject



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

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

#tagsObject



73
74
75
# File 'lib/axe/cuprite/results.rb', line 73

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