Class: Roma::AsyncMessage
- Inherits:
-
Object
- Object
- Roma::AsyncMessage
- Defined in:
- lib/roma/async_process.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#callback ⇒ Object
Returns the value of attribute callback.
-
#event ⇒ Object
Returns the value of attribute event.
Instance Method Summary collapse
- #incr_count ⇒ Object
-
#initialize(ev, ag = nil, &cb) ⇒ AsyncMessage
constructor
A new instance of AsyncMessage.
- #retry? ⇒ Boolean
- #wait ⇒ Object
Constructor Details
#initialize(ev, ag = nil, &cb) ⇒ AsyncMessage
Returns a new instance of AsyncMessage.
11 12 13 14 15 16 17 18 |
# File 'lib/roma/async_process.rb', line 11 def initialize(ev, ag = nil, &cb) @event = ev @args = ag @callback = cb @retry_count = 0 @retry_max = 10 @retry_wait = 0.1 end |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
8 9 10 |
# File 'lib/roma/async_process.rb', line 8 def args @args end |
#callback ⇒ Object
Returns the value of attribute callback.
9 10 11 |
# File 'lib/roma/async_process.rb', line 9 def callback @callback end |
#event ⇒ Object
Returns the value of attribute event.
7 8 9 |
# File 'lib/roma/async_process.rb', line 7 def event @event end |
Instance Method Details
#incr_count ⇒ Object
24 25 26 |
# File 'lib/roma/async_process.rb', line 24 def incr_count @retry_count += 1 end |
#retry? ⇒ Boolean
20 21 22 |
# File 'lib/roma/async_process.rb', line 20 def retry? @retry_max > @retry_count end |
#wait ⇒ Object
28 29 30 |
# File 'lib/roma/async_process.rb', line 28 def wait sleep(@retry_wait) end |