Sha256: 2272b8a49aa0555e2a62b9998b0369e088438080e93c7e09ca769105ce5abf60

Contents?: true

Size: 409 Bytes

Versions: 4

Compression:

Stored size: 409 Bytes

Contents

module EDN
  class Reader

    def initialize(source)
      @parser = Parser.new(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

4 entries across 4 versions & 1 rubygems

Version Path
edn-1.0.8 lib/edn/reader.rb
edn-1.0.7 lib/edn/reader.rb
edn-1.0.6 lib/edn/reader.rb
edn-1.0.5 lib/edn/reader.rb