Class: Isono::NodeModules::RpcChannel::ResponseContext
- Inherits:
-
Object
- Object
- Isono::NodeModules::RpcChannel::ResponseContext
- Defined in:
- lib/isono/node_modules/rpc_channel.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#header ⇒ Object
readonly
Returns the value of attribute header.
Instance Method Summary collapse
-
#initialize(exchange, header) ⇒ ResponseContext
constructor
A new instance of ResponseContext.
- #progress(ret) ⇒ Object
- #responded? ⇒ Boolean
- #response(ret) ⇒ Object
Constructor Details
#initialize(exchange, header) ⇒ ResponseContext
Returns a new instance of ResponseContext.
281 282 283 284 285 |
# File 'lib/isono/node_modules/rpc_channel.rb', line 281 def initialize(exchange, header) @responded = false @exchange = exchange @header = header end |
Instance Attribute Details
#header ⇒ Object (readonly)
Returns the value of attribute header.
279 280 281 |
# File 'lib/isono/node_modules/rpc_channel.rb', line 279 def header @header end |
Instance Method Details
#progress(ret) ⇒ Object
291 292 293 294 295 |
# File 'lib/isono/node_modules/rpc_channel.rb', line 291 def progress(ret) EM.schedule { publish(:inprogress, ret) } end |
#responded? ⇒ Boolean
287 288 289 |
# File 'lib/isono/node_modules/rpc_channel.rb', line 287 def responded? @responded end |
#response(ret) ⇒ Object
297 298 299 300 301 302 303 304 305 306 307 308 309 |
# File 'lib/isono/node_modules/rpc_channel.rb', line 297 def response(ret) raise "" if @responded EM.schedule { @header.ack if ret.is_a? Exception publish(:error, {:message=> ret., :error_type => ret.class.to_s}) else publish(:success, ret) end } @responded = true end |