Class: Covered::Include
Instance Attribute Summary collapse
-
#pattern ⇒ Object
readonly
Returns the value of attribute pattern.
Attributes inherited from Wrapper
Instance Method Summary collapse
- #each(&block) ⇒ Object
- #glob ⇒ Object
-
#initialize(output, pattern, base = "") ⇒ Include
constructor
A new instance of Include.
Methods inherited from Wrapper
#accept?, #disable, #enable, #expand_path, #mark, #relative_path, #to_h
Methods inherited from Base
#accept?, #disable, #enable, #expand_path, #mark, #relative_path
Constructor Details
#initialize(output, pattern, base = "") ⇒ Include
54 55 56 57 58 59 |
# File 'lib/covered/files.rb', line 54 def initialize(output, pattern, base = "") super(output) @pattern = pattern @base = base end |
Instance Attribute Details
#pattern ⇒ Object (readonly)
Returns the value of attribute pattern.
61 62 63 |
# File 'lib/covered/files.rb', line 61 def pattern @pattern end |
Instance Method Details
#each(&block) ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/covered/files.rb', line 77 def each(&block) paths = glob super do |coverage| paths.delete(coverage.path) yield coverage end paths.each do |path| yield Coverage.new(path) end end |
#glob ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/covered/files.rb', line 63 def glob paths = Set.new root = self.(@base) pattern = File.(@pattern, root) Dir.glob(pattern) do |path| unless File.directory?(path) paths << File.realpath(path) end end return paths end |