Sha256: 0411297aabb12f8a6c4f0130c80b86076ff34f60c635049d552d018f1d20212e

Contents?: true

Size: 834 Bytes

Versions: 416

Compression:

Stored size: 834 Bytes

Contents

module Gherkin
  module Listener
    class Event < Array
      def event
        self[0]
      end

      def keyword
        self[1]
      end
      
      def line_match?(lines)
        lines.include?(line)
      end

      def name_match?(name_regexen)
        return false unless [:feature, :background, :scenario, :scenario_outline, :examples].include?(event)
        name_regexen.detect{|name_regex| name =~ name_regex}
      end

      def replay(listener)
        begin
          listener.__send__(event, *args)
        rescue ArgumentError => e
          e.message << "\nListener: #{listener.class}, args: #{args.inspect}"
          raise e
        end
      end

    private

      def name
        self[2]
      end

      def line
        self[-1]
      end

      def args
        self[1..-1]
      end
    end
  end
end

Version data entries

416 entries across 409 versions & 11 rubygems

Version Path
honeybadger-2.4.0 vendor/gems/ruby/2.2.0/gems/gherkin-2.12.2/lib/gherkin/listener/event.rb
honeybadger-2.4.0 vendor/gems/ruby/2.1.0/gems/gherkin-2.12.2/lib/gherkin/listener/event.rb
honeybadger-2.4.0 vendor/gems/ruby/1.9.1/gems/gherkin-2.12.2/lib/gherkin/listener/event.rb
gherkin-2.12.2 lib/gherkin/listener/event.rb
gherkin-2.12.2-x86-mswin32 lib/gherkin/listener/event.rb
gherkin-2.12.2-x86-mingw32 lib/gherkin/listener/event.rb
gherkin-2.12.2-java lib/gherkin/listener/event.rb
candlepin-api-0.4.0 bundle/ruby/gems/gherkin-2.11.1/lib/gherkin/listener/event.rb
candlepin-api-0.4.0 bundle/ruby/1.9.1/gems/gherkin-2.11.1/lib/gherkin/listener/event.rb
candlepin-api-0.4.0 bundle/ruby/1.8/gems/gherkin-2.11.1/lib/gherkin/listener/event.rb
gherkin-2.12.1 lib/gherkin/listener/event.rb
gherkin-2.12.1-x86-mswin32 lib/gherkin/listener/event.rb
gherkin-2.12.1-x86-mingw32 lib/gherkin/listener/event.rb
gherkin-2.12.1-java lib/gherkin/listener/event.rb
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/gherkin-2.11.6/lib/gherkin/listener/event.rb
gherkin-2.12.0 lib/gherkin/listener/event.rb
gherkin-2.12.0-x86-mingw32 lib/gherkin/listener/event.rb
gherkin-2.12.0-x86-mswin32 lib/gherkin/listener/event.rb
gherkin-2.12.0-java lib/gherkin/listener/event.rb
gherkin-2.11.8 lib/gherkin/listener/event.rb