Class: AxeCuprite::Violation
- Inherits:
-
Object
- Object
- AxeCuprite::Violation
- Defined in:
- lib/axe/cuprite/results.rb
Overview
A single axe rule violation, with one or more offending nodes.
Instance Attribute Summary collapse
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
- #color_contrast? ⇒ Boolean
- #description ⇒ Object
- #help ⇒ Object
- #help_url ⇒ Object
- #id ⇒ Object
- #impact ⇒ Object
-
#initialize(raw) ⇒ Violation
constructor
A new instance of Violation.
- #nodes ⇒ Object
- #tags ⇒ Object
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
#raw ⇒ Object (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
110 111 112 |
# File 'lib/axe/cuprite/results.rb', line 110 def color_contrast? id == "color-contrast" end |
#description ⇒ Object
90 91 92 |
# File 'lib/axe/cuprite/results.rb', line 90 def description @raw["description"] end |
#help ⇒ Object
94 95 96 |
# File 'lib/axe/cuprite/results.rb', line 94 def help @raw["help"] end |
#help_url ⇒ Object
98 99 100 |
# File 'lib/axe/cuprite/results.rb', line 98 def help_url @raw["helpUrl"] end |
#id ⇒ Object
82 83 84 |
# File 'lib/axe/cuprite/results.rb', line 82 def id @raw["id"] end |
#impact ⇒ Object
86 87 88 |
# File 'lib/axe/cuprite/results.rb', line 86 def impact @raw["impact"] end |
#nodes ⇒ Object
106 107 108 |
# File 'lib/axe/cuprite/results.rb', line 106 def nodes @nodes ||= Array(@raw["nodes"]).map { |n| Node.new(n) } end |
#tags ⇒ Object
102 103 104 |
# File 'lib/axe/cuprite/results.rb', line 102 def Array(@raw["tags"]) end |