Class: Couve::Parser
- Inherits:
-
Object
- Object
- Couve::Parser
- Defined in:
- lib/couve/parser.rb
Instance Method Summary collapse
-
#initialize(coverage) ⇒ Parser
constructor
A new instance of Parser.
- #to_html ⇒ Object
Constructor Details
#initialize(coverage) ⇒ Parser
Returns a new instance of Parser.
4 5 6 7 8 |
# File 'lib/couve/parser.rb', line 4 def initialize(coverage) @coverage = JSON.parse(coverage, symbolize_names: true) @coverage[:source_files].reject! { |file| file[:covered_percent] == 100 } @coverage[:source_files].sort_by! { |file| file[:covered_percent] } end |
Instance Method Details
#to_html ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/couve/parser.rb', line 10 def to_html <<~HTML <html> <body> <div class="container mt-5"> <h1 class="display-5"> Coverage problems </h1> <table class="table table-hover mt-5"> <thead> <tr> <th class="col-1 text-end">Coverage</th> <th class="col-8">File</th> <th class="col-3">Not covered lines</th> </tr> </thead> #{body} </table> </div> <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous"> <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script> </body> </html> HTML end |