Sha256: 8b1bdd36f3be7f489f795463159e38082b1d6375a21f5207231e5312c7572601

Contents?: true

Size: 703 Bytes

Versions: 4

Compression:

Stored size: 703 Bytes

Contents

require 'gherkin'

module Gherkin
  module Tools
    # Base class for file based operations
    class Files
      include Enumerable

      def initialize(paths)
        raise "Please specify one or more paths" if paths.empty?
        @paths = paths
      end

      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

      def scan(file, listener)
        parser = Parser.new(listener, true)
        lexer = I18nLexer.new(parser)
        lexer.scan(IO.read(file))
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gherkin-1.0.2-i386-mswin32 lib/gherkin/tools/files.rb
gherkin-1.0.2-i386-mingw32 lib/gherkin/tools/files.rb
gherkin-1.0.2-java lib/gherkin/tools/files.rb
gherkin-1.0.2 lib/gherkin/tools/files.rb