Method: Cod::Service#one

Defined in:
lib/cod/service.rb

#one {|Object| ... } ⇒ Object

Waits until a request arrives on the service channel. Then reads that request and hands it to the block given. The block return value will be returned to the service client.

Use Cod::Client to perform the service call. This will keep track of messages sent and answers received and a couple of other things.

Yields:

  • (Object)

    request made by the client. The return value of the block will be returned to the client.



46
47
48
49
50
# File 'lib/cod/service.rb', line 46

def one
  rq, answer_chan = @channel.get
  res = yield(rq)
  answer_chan.put res if answer_chan
end