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.
49 50 51 |
# File 'lib/axe/cuprite/results.rb', line 49 def initialize(raw) @raw = raw || {} end |
Instance Attribute Details
#raw ⇒ Object (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
81 82 83 |
# File 'lib/axe/cuprite/results.rb', line 81 def color_contrast? id == "color-contrast" end |
#description ⇒ Object
61 62 63 |
# File 'lib/axe/cuprite/results.rb', line 61 def description @raw["description"] end |
#help ⇒ Object
65 66 67 |
# File 'lib/axe/cuprite/results.rb', line 65 def help @raw["help"] end |
#help_url ⇒ Object
69 70 71 |
# File 'lib/axe/cuprite/results.rb', line 69 def help_url @raw["helpUrl"] end |
#id ⇒ Object
53 54 55 |
# File 'lib/axe/cuprite/results.rb', line 53 def id @raw["id"] end |
#impact ⇒ Object
57 58 59 |
# File 'lib/axe/cuprite/results.rb', line 57 def impact @raw["impact"] end |
#nodes ⇒ Object
77 78 79 |
# File 'lib/axe/cuprite/results.rb', line 77 def nodes @nodes ||= Array(@raw["nodes"]).map { |n| Node.new(n) } end |
#tags ⇒ Object
73 74 75 |
# File 'lib/axe/cuprite/results.rb', line 73 def Array(@raw["tags"]) end |