Class: Xcov::IgnoreHandler
- Inherits:
-
Object
- Object
- Xcov::IgnoreHandler
- Defined in:
- lib/xcov/ignore_handler.rb
Instance Attribute Summary collapse
-
#list ⇒ Object
Returns the value of attribute list.
Class Method Summary collapse
-
.read_ignore_file ⇒ Object
Static methods.
Instance Method Summary collapse
-
#initialize ⇒ IgnoreHandler
constructor
A new instance of IgnoreHandler.
- #should_ignore_file(filename) ⇒ Object
Constructor Details
#initialize ⇒ IgnoreHandler
Returns a new instance of IgnoreHandler.
7 8 9 |
# File 'lib/xcov/ignore_handler.rb', line 7 def initialize @list = IgnoreHandler.read_ignore_file end |
Instance Attribute Details
#list ⇒ Object
Returns the value of attribute list.
5 6 7 |
# File 'lib/xcov/ignore_handler.rb', line 5 def list @list end |
Class Method Details
.read_ignore_file ⇒ Object
Static methods
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/xcov/ignore_handler.rb', line 21 def self.read_ignore_file require "yaml" ignore_file_path = Xcov.config[:ignore_file_path] ignore_list = [] begin ignore_list = YAML.load_file(ignore_file_path) rescue UI. "Skipping file blacklisting as no ignore file was found at path #{ignore_file_path}".yellow end return ignore_list end |
Instance Method Details
#should_ignore_file(filename) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/xcov/ignore_handler.rb', line 11 def should_ignore_file filename return false if @list.empty? return true if @list.include?(filename) # Evaluate possible regexs return @list.any? { |pattern| filename =~ Regexp.new("#{pattern}$") } end |