Class: Wally::ParsesFeatures

Inherits:
Object
  • Object
show all
Defined in:
lib/wally/parses_features.rb

Instance Method Summary collapse

Instance Method Details

#parse(text) ⇒ Object


14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/wally/parses_features.rb', line 14

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