Sha256: db2ab156f173e4e2420cf007ce821d97370a7a0fc35f210521be7199f897e527

Contents?: true

Size: 591 Bytes

Versions: 34

Compression:

Stored size: 591 Bytes

Contents

require 'stringio'
require 'gherkin/tools/files'
require 'gherkin/formatter/pretty_formatter'
require 'gherkin/listener/formatter_listener'

module Gherkin
  module Tools
    class Reformat < Files
      def run
        each do |file|
          io = defined?(JRUBY_VERSION) ? Java.java.io.StringWriter.new : StringIO.new
          formatter = Formatter::PrettyFormatter.new(io, true)
          parse(file, formatter)
          string = defined?(JRUBY_VERSION) ? io.getBuffer.toString : io.string
          File.open(file, 'w') {|io| io.write(string)}
        end
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
gherkin-2.2.7 lib/gherkin/tools/reformat.rb
gherkin-2.2.7-x86-mswin32 lib/gherkin/tools/reformat.rb
gherkin-2.2.7-x86-mingw32 lib/gherkin/tools/reformat.rb
gherkin-2.2.7-universal-dotnet lib/gherkin/tools/reformat.rb
gherkin-2.2.7-java lib/gherkin/tools/reformat.rb
gherkin-2.2.6 lib/gherkin/tools/reformat.rb
gherkin-2.2.6-x86-mswin32 lib/gherkin/tools/reformat.rb
gherkin-2.2.6-x86-mingw32 lib/gherkin/tools/reformat.rb
gherkin-2.2.6-universal-dotnet lib/gherkin/tools/reformat.rb
gherkin-2.2.6-java lib/gherkin/tools/reformat.rb
gherkin-2.2.5 lib/gherkin/tools/reformat.rb
gherkin-2.2.5-x86-mswin32 lib/gherkin/tools/reformat.rb
gherkin-2.2.5-x86-mingw32 lib/gherkin/tools/reformat.rb
gherkin-2.2.5-universal-dotnet lib/gherkin/tools/reformat.rb
gherkin-2.2.5-java lib/gherkin/tools/reformat.rb
gherkin-2.2.4 lib/gherkin/tools/reformat.rb
gherkin-2.2.4-i386-mswin32 lib/gherkin/tools/reformat.rb
gherkin-2.2.4-i386-mingw32 lib/gherkin/tools/reformat.rb
gherkin-2.2.4-universal-dotnet lib/gherkin/tools/reformat.rb
gherkin-2.2.4-java lib/gherkin/tools/reformat.rb