Sha256: 00b6aa50d188c7b71c6910de92f88794bdf43364caf3d02f48620d415565dcf4

Contents?: true

Size: 413 Bytes

Versions: 3

Compression:

Stored size: 413 Bytes

Contents

module EDN
  class Reader

    def initialize(source)
      @parser = EDN.new_parser(source)
    end

    def read(eof_value = NOTHING)
      result = @parser.read
      if result == EOF 
        raise "Unexpected end of file" if eof_value == NOTHING
        return eof_value
      end
      result
    end

    def each
      until (result = @parser.read) == EOF
        yield result
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
edn2023-1.1.4 lib/edn/reader.rb
edn-1.1.1 lib/edn/reader.rb
edn-1.1.0 lib/edn/reader.rb