Class: SimplecovHtmlInline::Formatter
- Inherits:
-
SimpleCov::Formatter::HTMLFormatter
- Object
- SimpleCov::Formatter::HTMLFormatter
- SimplecovHtmlInline::Formatter
- Defined in:
- lib/simplecov_html_inline/formatter.rb
Overview
A SimpleCov formatter based on SimpleCov::Formatter::HTMLFormatter that uses inline/embedded assets
Constant Summary collapse
- MEDIA_TYPE_MAPPING =
Mapping from file extension to media type
{ '.css' => 'text/css', '.gif' => 'image/gif', '.js' => 'text/javascript', '.png' => 'image/png', }.freeze
- PUBLIC_DIR =
Directory where simplecov-html assets live
Gem.find_latest_files( 'simplecov-html.rb' ).first.then do |simplecov_html_rb_path| dir = File.join(File.dirname(simplecov_html_rb_path), '..', 'public') File.absolute_path(dir).freeze end
Instance Method Summary collapse
-
#format(result) ⇒ Object
Creates an HTML coverage report with inline assets.
Instance Method Details
#format(result) ⇒ Object
Creates an HTML coverage report with inline assets
29 30 31 32 33 34 35 36 |
# File 'lib/simplecov_html_inline/formatter.rb', line 29 def format(result) # Same as SimpleCov::Formatter::HTMLFormatter#format except we omit the # copying of asset files File.open(File.join(output_path, 'index.html'), 'wb') do |file| file.puts template('layout').result(binding) end puts (result) end |