Class: SimpleCov::Formatter::TailwindFormatter
- Inherits:
-
Object
- Object
- SimpleCov::Formatter::TailwindFormatter
- Defined in:
- lib/simplecov-tailwindcss.rb,
lib/simplecov-tailwindcss/version.rb
Overview
rubocop:disable Metrics/ClassLength
Constant Summary collapse
- VERSION =
"2.2.0"
Instance Method Summary collapse
- #branchable_result? ⇒ Boolean
- #format(result) ⇒ Object
-
#initialize ⇒ TailwindFormatter
constructor
A new instance of TailwindFormatter.
- #line_status?(source_file, line) ⇒ Boolean
- #output_message(result) ⇒ Object
Constructor Details
#initialize ⇒ TailwindFormatter
Returns a new instance of TailwindFormatter.
18 19 20 |
# File 'lib/simplecov-tailwindcss.rb', line 18 def initialize @branchable_result = SimpleCov.branch_coverage? end |
Instance Method Details
#branchable_result? ⇒ Boolean
39 40 41 |
# File 'lib/simplecov-tailwindcss.rb', line 39 def branchable_result? @branchable_result end |
#format(result) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/simplecov-tailwindcss.rb', line 22 def format(result) Dir[File.join(File.dirname(__FILE__), "../public/*")].each do |path| FileUtils.cp_r(path, asset_output_path) end File.open(File.join(output_path, "index.html"), "wb") do |file| file.puts template("main").result(binding) end puts (result) end |
#line_status?(source_file, line) ⇒ Boolean
43 44 45 46 47 48 49 50 |
# File 'lib/simplecov-tailwindcss.rb', line 43 def line_status?(source_file, line) if branchable_result? && source_file.line_with_missed_branch?(line.number) "missed-branch" else line.status end end |
#output_message(result) ⇒ Object
33 34 35 36 37 |
# File 'lib/simplecov-tailwindcss.rb', line 33 def (result) "Coverage report generated for #{result.command_name} to " \ "#{output_path}. #{result.covered_lines} / #{result.total_lines} LOC " \ "(#{result.covered_percent.round(2)}%) covered." end |