Class: AxeCuprite::Results
- Inherits:
-
Object
- Object
- AxeCuprite::Results
- Defined in:
- lib/axe/cuprite/results.rb
Overview
Wraps the (slimmed) payload returned by axe.run. We deliberately only carry ‘violations` and `incomplete` across the CDP boundary plus a little metadata — the full results object (with `passes`/`inapplicable`) can be huge.
Instance Attribute Summary collapse
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
-
#incomplete ⇒ Object
Nodes axe could not decide on (needs review).
-
#initialize(raw) ⇒ Results
constructor
A new instance of Results.
- #passes? ⇒ Boolean (also: #clean?)
- #test_engine ⇒ Object
- #timestamp ⇒ Object
- #to_h ⇒ Object
- #url ⇒ Object
- #violations ⇒ Object
Constructor Details
#initialize(raw) ⇒ Results
Returns a new instance of Results.
10 11 12 |
# File 'lib/axe/cuprite/results.rb', line 10 def initialize(raw) @raw = raw || {} end |
Instance Attribute Details
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
8 9 10 |
# File 'lib/axe/cuprite/results.rb', line 8 def raw @raw end |
Instance Method Details
#incomplete ⇒ Object
Nodes axe could not decide on (needs review). Surfaced but never fails.
19 20 21 |
# File 'lib/axe/cuprite/results.rb', line 19 def incomplete @incomplete ||= Array(@raw["incomplete"]).map { |v| Violation.new(v) } end |
#passes? ⇒ Boolean Also known as: clean?
23 24 25 |
# File 'lib/axe/cuprite/results.rb', line 23 def passes? violations.empty? end |
#test_engine ⇒ Object
36 37 38 |
# File 'lib/axe/cuprite/results.rb', line 36 def test_engine @raw["testEngine"] end |
#timestamp ⇒ Object
32 33 34 |
# File 'lib/axe/cuprite/results.rb', line 32 def @raw["timestamp"] end |
#to_h ⇒ Object
40 41 42 |
# File 'lib/axe/cuprite/results.rb', line 40 def to_h @raw end |
#url ⇒ Object
28 29 30 |
# File 'lib/axe/cuprite/results.rb', line 28 def url @raw["url"] end |