Class: AuditService
- Inherits:
-
Object
- Object
- AuditService
- Defined in:
- lib/lighthouse/audit_service.rb
Overview
Compares a url’s actual score to the expected score.
Defined Under Namespace
Classes: Error
Instance Method Summary collapse
-
#initialize(url, audit, score) ⇒ AuditService
constructor
A new instance of AuditService.
- #measured_score ⇒ Object
- #passing_score? ⇒ Boolean
- #run_warnings ⇒ Object
Constructor Details
#initialize(url, audit, score) ⇒ AuditService
Returns a new instance of AuditService.
10 11 12 13 14 15 16 17 18 |
# File 'lib/lighthouse/audit_service.rb', line 10 def initialize(url, audit, score) @url = url @audit = audit @score = score @port = Lighthouse::Matchers.remote_debugging_port @runner = Lighthouse::Matchers.runner @cmd = Lighthouse::Matchers.lighthouse_cli @chrome_flags = Lighthouse::Matchers.chrome_flags end |
Instance Method Details
#measured_score ⇒ Object
24 25 26 |
# File 'lib/lighthouse/audit_service.rb', line 24 def measured_score category['score'] * 100 end |
#passing_score? ⇒ Boolean
20 21 22 |
# File 'lib/lighthouse/audit_service.rb', line 20 def passing_score? measured_score >= @score end |
#run_warnings ⇒ Object
28 29 30 |
# File 'lib/lighthouse/audit_service.rb', line 28 def run_warnings results['runWarnings'] end |