Class: Faye::Scheduler
- Inherits:
-
Object
- Object
- Faye::Scheduler
- Defined in:
- lib/faye/protocol/scheduler.rb
Instance Method Summary collapse
- #abort! ⇒ Object
- #deliverable? ⇒ Boolean
- #fail! ⇒ Object
-
#initialize(message, options) ⇒ Scheduler
constructor
A new instance of Scheduler.
- #interval ⇒ Object
- #send! ⇒ Object
- #succeed! ⇒ Object
- #timeout ⇒ Object
Constructor Details
#initialize(message, options) ⇒ Scheduler
Returns a new instance of Scheduler.
4 5 6 7 8 |
# File 'lib/faye/protocol/scheduler.rb', line 4 def initialize(, ) @message = @options = @attempts = 0 end |
Instance Method Details
#abort! ⇒ Object
39 40 |
# File 'lib/faye/protocol/scheduler.rb', line 39 def abort! end |
#deliverable? ⇒ Boolean
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/faye/protocol/scheduler.rb', line 18 def deliverable? attempts = @options[:attempts] deadline = @options[:deadline] now = Time.now.to_f return false if attempts and @attempts >= attempts return false if deadline and now > deadline true end |
#fail! ⇒ Object
36 37 |
# File 'lib/faye/protocol/scheduler.rb', line 36 def fail! end |
#interval ⇒ Object
10 11 12 |
# File 'lib/faye/protocol/scheduler.rb', line 10 def interval @options[:interval] end |
#send! ⇒ Object
29 30 31 |
# File 'lib/faye/protocol/scheduler.rb', line 29 def send! @attempts += 1 end |
#succeed! ⇒ Object
33 34 |
# File 'lib/faye/protocol/scheduler.rb', line 33 def succeed! end |
#timeout ⇒ Object
14 15 16 |
# File 'lib/faye/protocol/scheduler.rb', line 14 def timeout @options[:timeout] end |