Sha256: 52d0a9ce0286d0556690378bc53cf217cb34cadb7abaf959fa0c351c35c72e10
Contents?: true
Size: 841 Bytes
Versions: 21
Compression:
Stored size: 841 Bytes
Contents
require 'riak/util/escape' require 'riak/json' module Riak class Client class HTTPBackend # @private class KeyStreamer include Util::Escape def initialize(block) @buffer = "" @block = block end def accept(chunk) @buffer << chunk consume end def to_proc method(:accept).to_proc end private def consume while @buffer =~ /\}\{/ stream($~.pre_match + '}') @buffer = '{' + $~.post_match end end def stream(str) obj = JSON.parse(str) rescue nil if obj && obj['keys'] @block.call obj['keys'].map(&method(:maybe_unescape)) end end end end end end
Version data entries
21 entries across 11 versions & 2 rubygems