Sha256: c603b1d14b7df3d6a2bf90cc861f35aa33e55d86a15bba2df61242e3e1736bb8

Contents?: true

Size: 625 Bytes

Versions: 21

Compression:

Stored size: 625 Bytes

Contents

require 'gherkin/formatter/json_formatter'
require 'gherkin/parser/parser'

module Gherkin::Formatter
  class JSONFormatter
    def to_hash
      @feature_hash
    end
  end
end

module Wally
  class ParsesFeatures
    def parse text
      io = StringIO.new
      formatter = Gherkin::Formatter::JSONFormatter.new(io)
      parser = Gherkin::Parser::Parser.new(formatter, false, 'root')
      begin
        parser.parse(text, nil, 0)
      rescue Exception => e
        raise FeatureParseException.new
      end
      hash = formatter.to_hash
      hash
    end
  end

  class FeatureParseException < StandardError
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
wally-0.0.47 lib/wally/parses_features.rb
wally-client-0.0.3 lib/wally/parses_features.rb
wally-client-0.0.2 lib/wally/parses_features.rb
wally-client-0.0.1 lib/wally/parses_features.rb
wally-0.0.46 lib/wally/parses_features.rb
wally-0.0.45 lib/wally/parses_features.rb
wally-0.0.44 lib/wally/parses_features.rb
wally-0.0.43 lib/wally/parses_features.rb
wally-0.0.42 lib/wally/parses_features.rb
wally-0.0.41 lib/wally/parses_features.rb
wally-0.0.40 lib/wally/parses_features.rb
wally-0.0.39 lib/wally/parses_features.rb
wally-0.0.38 lib/wally/parses_features.rb
wally-0.0.37 lib/wally/parses_features.rb
wally-0.0.36 lib/wally/parses_features.rb
wally-0.0.35 lib/wally/parses_features.rb
wally-0.0.34 lib/wally/parses_features.rb
wally-0.0.33 lib/wally/parses_features.rb
wally-0.0.32 lib/wally/parses_features.rb
wally-0.0.31 lib/wally/parses_features.rb