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.
71 72 73 |
# File 'lib/axe/cuprite/results.rb', line 71 def initialize(raw) @raw = DeepFreeze.call(raw || {}) end |
Instance Attribute Details
#raw ⇒ Object (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
103 104 105 |
# File 'lib/axe/cuprite/results.rb', line 103 def color_contrast? id == "color-contrast" end |
#description ⇒ Object
83 84 85 |
# File 'lib/axe/cuprite/results.rb', line 83 def description @raw["description"] end |
#help ⇒ Object
87 88 89 |
# File 'lib/axe/cuprite/results.rb', line 87 def help @raw["help"] end |
#help_url ⇒ Object
91 92 93 |
# File 'lib/axe/cuprite/results.rb', line 91 def help_url @raw["helpUrl"] end |
#id ⇒ Object
75 76 77 |
# File 'lib/axe/cuprite/results.rb', line 75 def id @raw["id"] end |
#impact ⇒ Object
79 80 81 |
# File 'lib/axe/cuprite/results.rb', line 79 def impact @raw["impact"] end |
#nodes ⇒ Object
99 100 101 |
# File 'lib/axe/cuprite/results.rb', line 99 def nodes @nodes ||= Array(@raw["nodes"]).map { |n| Node.new(n) } end |
#tags ⇒ Object
95 96 97 |
# File 'lib/axe/cuprite/results.rb', line 95 def Array(@raw["tags"]) end |