Sha256: 2f85c3203ae9e9a9f833be88fcc9ecd8ba75b98623bf9f57321636b181b908e4

Contents?: true

Size: 749 Bytes

Versions: 33

Compression:

Stored size: 749 Bytes

Contents

module Gherkin
  class SexpRecorder
    def initialize
      @sexps = []
    end

    def method_missing(event, *args)
      event = :scenario_outline if event == :scenarioOutline # Special Java Lexer handling
      event = :py_string if event == :pyString # Special Java Lexer handling
      event = :syntax_error if event == :syntaxError # Special Java Lexer handling
      args[0] = args[0].to_a if event == :row # Special JRuby handling
      @sexps << [event] + args
    end

    def to_sexp
      @sexps
    end

    # Useful in IRB
    def reset!
      @sexps = []
    end

    def errors
      @sexps.select { |sexp| sexp[0] == :syntax_error }
    end

    def line(number)
      @sexps.find { |sexp| sexp.last == number }
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
gherkin-1.0.30 spec/gherkin/sexp_recorder.rb
gherkin-1.0.30-i386-mswin32 spec/gherkin/sexp_recorder.rb
gherkin-1.0.30-i386-mingw32 spec/gherkin/sexp_recorder.rb
gherkin-1.0.30-universal-dotnet spec/gherkin/sexp_recorder.rb
gherkin-1.0.30-java spec/gherkin/sexp_recorder.rb
gherkin-1.0.29 spec/gherkin/sexp_recorder.rb
gherkin-1.0.29-i386-mswin32 spec/gherkin/sexp_recorder.rb
gherkin-1.0.29-i386-mingw32 spec/gherkin/sexp_recorder.rb
gherkin-1.0.29-java spec/gherkin/sexp_recorder.rb
gherkin-1.0.28 spec/gherkin/sexp_recorder.rb
gherkin-1.0.28-i386-mswin32 spec/gherkin/sexp_recorder.rb
gherkin-1.0.28-i386-mingw32 spec/gherkin/sexp_recorder.rb
gherkin-1.0.28-java spec/gherkin/sexp_recorder.rb
gherkin-1.0.27 spec/gherkin/sexp_recorder.rb
gherkin-1.0.27-i386-mswin32 spec/gherkin/sexp_recorder.rb
gherkin-1.0.27-i386-mingw32 spec/gherkin/sexp_recorder.rb
gherkin-1.0.27-java spec/gherkin/sexp_recorder.rb
gherkin-1.0.26 spec/gherkin/sexp_recorder.rb
gherkin-1.0.26-i386-mswin32 spec/gherkin/sexp_recorder.rb
gherkin-1.0.26-i386-mingw32 spec/gherkin/sexp_recorder.rb