Sha256: 298efc285b74402b31146cee879251966bee70cf6f7eb291d8b7e1926abb02c2

Contents?: true

Size: 800 Bytes

Versions: 33

Compression:

Stored size: 800 Bytes

Contents

module Gherkin
  module Parser
    class Event < Array
      def initialize(*args)
        super
        self[1] = self[1].to_a if event == :row # Special JRuby handling
      end

      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)
        listener.__send__(event, *args)
      end

    private

      def name
        self[2]
      end

      def line
        self[-1]
      end

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

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
gherkin-1.0.30 lib/gherkin/parser/event.rb
gherkin-1.0.30-i386-mswin32 lib/gherkin/parser/event.rb
gherkin-1.0.30-i386-mingw32 lib/gherkin/parser/event.rb
gherkin-1.0.30-universal-dotnet lib/gherkin/parser/event.rb
gherkin-1.0.30-java lib/gherkin/parser/event.rb
gherkin-1.0.29 lib/gherkin/parser/event.rb
gherkin-1.0.29-i386-mswin32 lib/gherkin/parser/event.rb
gherkin-1.0.29-i386-mingw32 lib/gherkin/parser/event.rb
gherkin-1.0.29-java lib/gherkin/parser/event.rb
gherkin-1.0.28 lib/gherkin/parser/event.rb
gherkin-1.0.28-i386-mswin32 lib/gherkin/parser/event.rb
gherkin-1.0.28-i386-mingw32 lib/gherkin/parser/event.rb
gherkin-1.0.28-java lib/gherkin/parser/event.rb
gherkin-1.0.27 lib/gherkin/parser/event.rb
gherkin-1.0.27-i386-mswin32 lib/gherkin/parser/event.rb
gherkin-1.0.27-i386-mingw32 lib/gherkin/parser/event.rb
gherkin-1.0.27-java lib/gherkin/parser/event.rb
gherkin-1.0.26 lib/gherkin/parser/event.rb
gherkin-1.0.26-i386-mswin32 lib/gherkin/parser/event.rb
gherkin-1.0.26-i386-mingw32 lib/gherkin/parser/event.rb