Class: Roma::AsyncMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/roma/async_process.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#argsObject

Returns the value of attribute args.



8
9
10
# File 'lib/roma/async_process.rb', line 8

def args
  @args
end

#callbackObject

Returns the value of attribute callback.



9
10
11
# File 'lib/roma/async_process.rb', line 9

def callback
  @callback
end

#eventObject

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_countObject



24
25
26
# File 'lib/roma/async_process.rb', line 24

def incr_count
  @retry_count += 1
end

#retry?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/roma/async_process.rb', line 20

def retry?
  @retry_max > @retry_count
end

#waitObject



28
29
30
# File 'lib/roma/async_process.rb', line 28

def wait
  sleep(@retry_wait)
end