### Home Classes Methods

### In Files

- lib/gherkin/tools/reformat.rb

### Parent

Gherkin::Tools::Files

### Methods

- #run

### 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::Reformat

### Public Instance Methods

run() click to toggle source

    # File lib/gherkin/tools/reformat.rb, line 9
    def run
      each do |file|
        io = defined?(JRUBY_VERSION) ? Java.java.io.StringWriter.new : StringIO.new
        formatter = Formatter::PrettyFormatter.new(io, true)
        listener = Parser::FormatterListener.new(formatter)
        scan(file, listener)
        string = defined?(JRUBY_VERSION) ? io.getBuffer.toString : io.string
        File.open(file, 'w') {|io| io.write(string)}
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.