Class: CouchRest::Streamer

Inherits:
Object
  • Object
show all
Defined in:
lib/couchrest/helper/streamer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeStreamer


6
7
8
# File 'lib/couchrest/helper/streamer.rb', line 6

def initialize
  self.default_curl_opts = "--silent --no-buffer --tcp-nodelay -H \"Content-Type: application/json\""
end

Instance Attribute Details

#default_curl_optsObject

Returns the value of attribute default_curl_opts


4
5
6
# File 'lib/couchrest/helper/streamer.rb', line 4

def default_curl_opts
  @default_curl_opts
end

Instance Method Details

#get(url, &block) ⇒ Object


14
15
16
# File 'lib/couchrest/helper/streamer.rb', line 14

def get(url, &block)
  open_pipe("curl #{default_curl_opts} \"#{url}\"", &block)
end

#post(url, params = {}, &block) ⇒ Object


18
19
20
# File 'lib/couchrest/helper/streamer.rb', line 18

def post(url, params = {}, &block)
  open_pipe("curl #{default_curl_opts} -d \"#{escape_quotes(MultiJson.encode(params))}\" \"#{url}\"", &block)
end

#view(*args) ⇒ Object


10
11
12
# File 'lib/couchrest/helper/streamer.rb', line 10

def view(*args)
  raise "CouchRest::Streamer#view is deprecated. Please use Database#view with block."
end