Class: Riak::Client::HTTPBackend::KeyStreamer

Inherits:
Object
  • Object
show all
Includes:
Util::Escape
Defined in:
lib/riak/client/http_backend/key_streamer.rb

Instance Method Summary collapse

Methods included from Util::Escape

#escape, #maybe_escape, #maybe_unescape, #unescape

Constructor Details

#initialize(block) ⇒ KeyStreamer

Returns a new instance of KeyStreamer.



11
12
13
14
# File 'lib/riak/client/http_backend/key_streamer.rb', line 11

def initialize(block)
  @buffer = ""
  @block = block
end

Instance Method Details

#accept(chunk) ⇒ Object



16
17
18
19
# File 'lib/riak/client/http_backend/key_streamer.rb', line 16

def accept(chunk)
  @buffer << chunk
  consume
end

#to_procObject



21
22
23
# File 'lib/riak/client/http_backend/key_streamer.rb', line 21

def to_proc
  method(:accept).to_proc
end