Class: Gherkin::Tools::Files
- Inherits:
-
Object
- Object
- Gherkin::Tools::Files
- Includes:
- Enumerable
- Defined in:
- lib/gherkin/tools/files.rb
Overview
Base class for file based operations
Instance Method Summary collapse
- #each(&proc) ⇒ Object
-
#initialize(paths) ⇒ Files
constructor
A new instance of Files.
- #parse(file, formatter) ⇒ Object
Constructor Details
#initialize(paths) ⇒ Files
Returns a new instance of Files.
9 10 11 12 |
# File 'lib/gherkin/tools/files.rb', line 9 def initialize(paths) raise "Please specify one or more paths" if paths.empty? @paths = paths end |
Instance Method Details
#each(&proc) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/gherkin/tools/files.rb', line 14 def each(&proc) globs = @paths.map do |path| raise "#{path} does not exist" unless File.exist?(path) File.directory?(path) ? File.join(path, '**', '*.feature') : path end Dir[*globs].uniq.sort.each(&proc) end |