Class: Cod::Service::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/cod/service.rb

Overview

A service client.

Direct Known Subclasses

Beanstalk::Service::Client

Instance Method Summary collapse

Constructor Details

#initialize(server_chan, answer_chan = nil) ⇒ Client

Returns a new instance of Client.



55
56
57
# File 'lib/cod/service.rb', line 55

def initialize(server_chan, answer_chan=nil)
  @server_chan, @answer_chan = server_chan, answer_chan || server_chan
end

Instance Method Details

#call(rq) ⇒ Object



59
60
61
62
# File 'lib/cod/service.rb', line 59

def call(rq)
  @server_chan.put [rq, @answer_chan]
  @answer_chan.get
end

#closeObject



68
69
70
71
# File 'lib/cod/service.rb', line 68

def close
  @server_chan.close
  @answer_chan.close
end

#notify(rq) ⇒ Object



64
65
66
# File 'lib/cod/service.rb', line 64

def notify(rq)
  @server_chan.put [rq, nil]
end