Sha256: db63c9bc3969cfd608e2c33189ee91ed3ed18aabff1a5d5991978829eaa6ee5d
Contents?: true
Size: 1.14 KB
Versions: 2
Compression:
Stored size: 1.14 KB
Contents
# frozen_string_literal: true require 'gherkin/gherkin' module Cucumber module Core module Gherkin ParseError = Class.new(StandardError) class Parser attr_reader :receiver, :event_bus private :receiver, :event_bus def initialize(receiver, event_bus) @receiver = receiver @event_bus = event_bus end def document(document) messages = ::Gherkin::Gherkin.from_source(document.uri, document.body, {default_dialect: document.language, include_source: false}) messages.each do |message| if !message.gherkinDocument.nil? event_bus.gherkin_source_parsed(message.gherkinDocument) elsif !message.pickle.nil? receiver.pickle(message.pickle) elsif !message.attachment.nil? # Parse error raise Core::Gherkin::ParseError.new("#{document.uri}: #{message.attachment.data}") else raise "Unknown message: #{message.to_hash}" end end end def done receiver.done self end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cucumber-core-5.0.1 | lib/cucumber/core/gherkin/parser.rb |
cucumber-core-5.0.0 | lib/cucumber/core/gherkin/parser.rb |