Class: BBC::A11y::LintResult
- Inherits:
-
Object
- Object
- BBC::A11y::LintResult
- Defined in:
- lib/bbc/a11y/linter.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#skipped ⇒ Object
readonly
Returns the value of attribute skipped.
Class Method Summary collapse
Instance Method Summary collapse
- #failed? ⇒ Boolean
-
#initialize(errors, skipped) ⇒ LintResult
constructor
A new instance of LintResult.
- #passed? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(errors, skipped) ⇒ LintResult
Returns a new instance of LintResult.
21 22 23 24 |
# File 'lib/bbc/a11y/linter.rb', line 21 def initialize(errors, skipped) @errors = errors @skipped = skipped end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
50 51 52 |
# File 'lib/bbc/a11y/linter.rb', line 50 def errors @errors end |
#skipped ⇒ Object (readonly)
Returns the value of attribute skipped.
50 51 52 |
# File 'lib/bbc/a11y/linter.rb', line 50 def skipped @skipped end |
Class Method Details
.from_json(json) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/bbc/a11y/linter.rb', line 38 def self.from_json(json) errors = json["results"].map { |standard_result| standard_result["errors"].map { || = .join ' ' LintError.new(standard_result["standard"]["section"], standard_result["standard"]["name"], ) } }.flatten LintResult.new(errors, json["skipped"]) end |
Instance Method Details
#failed? ⇒ Boolean
30 31 32 |
# File 'lib/bbc/a11y/linter.rb', line 30 def failed? !passed? end |
#passed? ⇒ Boolean
26 27 28 |
# File 'lib/bbc/a11y/linter.rb', line 26 def passed? @errors.empty? end |
#to_s ⇒ Object
34 35 36 |
# File 'lib/bbc/a11y/linter.rb', line 34 def to_s @errors.map(&:to_s).join("\n") end |