### Home Classes Methods

### In Files

- lib/gherkin/tools/files.rb

### Parent

Object

### Methods

- ::new
- #each
- #scan

### Included Modules

- Enumerable

### Files

- LICENSE
- README.rdoc
- meta.txt
- root.txt
- steps.txt
- README.rdoc

### Class/Module Index

Quicksearch

- Gherkin
- Gherkin::CLexer
- Gherkin::Cli
- Gherkin::Cli::Main
- Gherkin::Formatter
- Gherkin::Formatter::Argument
- Gherkin::Formatter::Colors
- Gherkin::Formatter::Escaping
- Gherkin::Formatter::JSONFormatter
- Gherkin::Formatter::MonochromeFormat
- Gherkin::Formatter::PrettyFormatter
- Gherkin::I18n
- Gherkin::I18nLexer
- Gherkin::JSONLexer
- Gherkin::Parser
- Gherkin::Parser::Event
- Gherkin::Parser::FilterListener
- Gherkin::Parser::FormatterListener
- Gherkin::Parser::ParseError
- Gherkin::Parser::Parser
- Gherkin::Parser::Parser::Machine
- Gherkin::Parser::Parser::Machine::StateMachineReader
- Gherkin::Parser::Row
- Gherkin::Parser::TagExpression
- Gherkin::RbLexer
- Gherkin::Rubify
- Gherkin::Tools
- Gherkin::Tools::Files
- Gherkin::Tools::Reformat
- Gherkin::Tools::Stats
- Gherkin::Tools::StatsListener
- Class

No matching classes.

# Gherkin::Tools::Files

Base class for file based operations

### Public Class Methods

new(paths) click to toggle source

    # File lib/gherkin/tools/files.rb, line 9
    def initialize(paths)
      raise "Please specify one or more paths" if paths.empty?
      @paths = paths
    end

### Public Instance Methods

each(&proc) click to toggle source

    # 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

scan(file, listener) click to toggle source

    # File lib/gherkin/tools/files.rb, line 23
    def scan(file, listener)
      parser = Gherkin::Parser::Parser.new(listener, true, "root")
      lexer = Gherkin::I18nLexer.new(parser, false)
      begin
        lexer.scan(IO.read(file), file, 0)
      rescue => e
        e.message << " (#{file})"
        raise e
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.