Sha256: 58195bf000446aa576ef50c1e90050723983a828019bbcc238ec0d78998c10fb

Contents?: true

Size: 590 Bytes

Versions: 23

Compression:

Stored size: 590 Bytes

Contents

require 'gherkin/parser/parser'
require 'gherkin/formatter/json_formatter'
require 'stringio'
require 'multi_json'

# This example reads a couple of features and outputs them as JSON.

io = StringIO.new
formatter = Gherkin::Formatter::JSONFormatter.new(io)
parser = Gherkin::Parser::Parser.new(formatter)

sources = ["features/native_lexer.feature", "features/escaped_pipes.feature"]
sources.each do |s|
  path = File.expand_path(File.dirname(__FILE__) + '/../' + s)
  parser.parse(IO.read(path), path, 0)
end

formatter.done
puts MultiJson.dump(MultiJson.load(io.string), :pretty => true)

Version data entries

23 entries across 21 versions & 2 rubygems

Version Path
honeybadger-2.4.0 vendor/gems/ruby/1.9.1/gems/gherkin-2.12.2/examples/parse_and_output_json.rb
honeybadger-2.4.0 vendor/gems/ruby/2.2.0/gems/gherkin-2.12.2/examples/parse_and_output_json.rb
honeybadger-2.4.0 vendor/gems/ruby/2.1.0/gems/gherkin-2.12.2/examples/parse_and_output_json.rb
gherkin-2.12.2 examples/parse_and_output_json.rb
gherkin-2.12.2-x86-mswin32 examples/parse_and_output_json.rb
gherkin-2.12.2-x86-mingw32 examples/parse_and_output_json.rb
gherkin-2.12.2-java examples/parse_and_output_json.rb
gherkin-2.12.1 examples/parse_and_output_json.rb
gherkin-2.12.1-x86-mswin32 examples/parse_and_output_json.rb
gherkin-2.12.1-x86-mingw32 examples/parse_and_output_json.rb
gherkin-2.12.1-java examples/parse_and_output_json.rb
gherkin-2.12.0 examples/parse_and_output_json.rb
gherkin-2.12.0-x86-mingw32 examples/parse_and_output_json.rb
gherkin-2.12.0-x86-mswin32 examples/parse_and_output_json.rb
gherkin-2.12.0-java examples/parse_and_output_json.rb
gherkin-2.11.8 examples/parse_and_output_json.rb
gherkin-2.11.8-x86-mswin32 examples/parse_and_output_json.rb
gherkin-2.11.8-x86-mingw32 examples/parse_and_output_json.rb
gherkin-2.11.8-java examples/parse_and_output_json.rb
gherkin-2.11.7 examples/parse_and_output_json.rb