Sha256: facc71b555caa58dc2f14b91bb9cf784cf6f0d92f07938dc0b15e12848145fac

Contents?: true

Size: 498 Bytes

Versions: 76

Compression:

Stored size: 498 Bytes

Contents

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

    def method_missing(event, *args)
      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

76 entries across 76 versions & 1 rubygems

Version Path
gherkin-1.0.22 spec/gherkin/sexp_recorder.rb
gherkin-1.0.22-i386-mswin32 spec/gherkin/sexp_recorder.rb
gherkin-1.0.22-i386-mingw32 spec/gherkin/sexp_recorder.rb
gherkin-1.0.22-java spec/gherkin/sexp_recorder.rb
gherkin-1.0.21 spec/gherkin/sexp_recorder.rb
gherkin-1.0.21-i386-mswin32 spec/gherkin/sexp_recorder.rb
gherkin-1.0.21-i386-mingw32 spec/gherkin/sexp_recorder.rb
gherkin-1.0.21-java spec/gherkin/sexp_recorder.rb
gherkin-1.0.20 spec/gherkin/sexp_recorder.rb
gherkin-1.0.20-i386-mswin32 spec/gherkin/sexp_recorder.rb
gherkin-1.0.20-i386-mingw32 spec/gherkin/sexp_recorder.rb
gherkin-1.0.20-java spec/gherkin/sexp_recorder.rb
gherkin-1.0.19 spec/gherkin/sexp_recorder.rb
gherkin-1.0.19-i386-mswin32 spec/gherkin/sexp_recorder.rb
gherkin-1.0.19-i386-mingw32 spec/gherkin/sexp_recorder.rb
gherkin-1.0.19-java spec/gherkin/sexp_recorder.rb
gherkin-1.0.18 spec/gherkin/sexp_recorder.rb
gherkin-1.0.18-i386-mswin32 spec/gherkin/sexp_recorder.rb
gherkin-1.0.18-i386-mingw32 spec/gherkin/sexp_recorder.rb
gherkin-1.0.18-java spec/gherkin/sexp_recorder.rb