Sha256: 8fdb16c64f73861237f4982d21f90bece60dfb46feb92c19f2db7acbf379e38d

Contents?: true

Size: 473 Bytes

Versions: 4

Compression:

Stored size: 473 Bytes

Contents

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

    def method_missing(m, *args)
      args[0] = args[0].map{|cell| cell} if m == :row
      @sexps << [m] + 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

4 entries across 4 versions & 1 rubygems

Version Path
gherkin-1.0.3-i386-mswin32 spec/gherkin/sexp_recorder.rb
gherkin-1.0.3-i386-mingw32 spec/gherkin/sexp_recorder.rb
gherkin-1.0.3-java spec/gherkin/sexp_recorder.rb
gherkin-1.0.3 spec/gherkin/sexp_recorder.rb