Module: SimpleCov::Directive::Template
- Defined in:
- lib/simplecov/directive/template.rb
Overview
Hands a template's lines to the extractor for its language, so the directive scan sees only the Ruby a template holds, at the template's own line numbers. A file in no template language is Ruby already.
Constant Summary collapse
- EXTRACTORS =
{".erb" => Erb, ".haml" => Haml, ".slim" => Slim}.freeze
Class Method Summary collapse
Class Method Details
.blank(text) ⇒ Object
24 25 26 |
# File 'lib/simplecov/directive/template.rb', line 24 def self.blank(text) text.gsub(/[^\n]/, " ") end |
.ruby_lines(filename, lines) ⇒ Object
19 20 21 22 |
# File 'lib/simplecov/directive/template.rb', line 19 def self.ruby_lines(filename, lines) extractor = EXTRACTORS[File.extname(filename)] extractor ? extractor.ruby_lines(lines) : lines end |
.template?(filename) ⇒ Boolean
15 16 17 |
# File 'lib/simplecov/directive/template.rb', line 15 def self.template?(filename) EXTRACTORS.key?(File.extname(filename)) end |