Class: RPC::Clients::NetHttp
- Inherits:
-
Object
- Object
- RPC::Clients::NetHttp
- Defined in:
- lib/rpc/lib/rpc/clients/net-http.rb
Instance Method Summary collapse
- #async? ⇒ Boolean
- #connect ⇒ Object
- #disconnect ⇒ Object
-
#initialize(uri) ⇒ NetHttp
constructor
A new instance of NetHttp.
- #run(&block) ⇒ Object
- #send(data) ⇒ Object
Constructor Details
Instance Method Details
#async? ⇒ Boolean
50 51 52 |
# File 'lib/rpc/lib/rpc/clients/net-http.rb', line 50 def async? false end |
#connect ⇒ Object
26 27 28 |
# File 'lib/rpc/lib/rpc/clients/net-http.rb', line 26 def connect @client.start end |
#disconnect ⇒ Object
30 31 32 |
# File 'lib/rpc/lib/rpc/clients/net-http.rb', line 30 def disconnect @client.finish end |
#run(&block) ⇒ Object
34 35 36 37 38 |
# File 'lib/rpc/lib/rpc/clients/net-http.rb', line 34 def run(&block) self.connect block.call self.disconnect end |
#send(data) ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/rpc/lib/rpc/clients/net-http.rb', line 40 def send(data) path = @uri.path.empty? ? "/" : @uri.path begin @client.post(path, data, HEADERS).body rescue EOFError retry end end |