Class: Faye::Scheduler

Inherits:
Object
  • Object
show all
Defined in:
lib/faye/protocol/scheduler.rb

Instance Method Summary collapse

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)
  @message  = message
  @options  = options
  @attempts = 0
end

Instance Method Details

#abort!Object



39
40
# File 'lib/faye/protocol/scheduler.rb', line 39

def abort!
end

#deliverable?Boolean

Returns:

  • (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

#intervalObject



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

#timeoutObject



14
15
16
# File 'lib/faye/protocol/scheduler.rb', line 14

def timeout
  @options[:timeout]
end