Class: Adhearsion::Call::CallMessageQueue

Inherits:
Queue
  • Object
show all
Defined in:
lib/adhearsion/voip/call.rb

Overview

Wraps the Queue object (subclasses it) so we can handle runaway threads, namely those originating from using with_next_message in commands.rb - this overrides << to check for the :cancel symbol and trigger the automessaging_tainted instance variable.

Defined Under Namespace

Classes: InboxClosedException

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCallMessageQueue

Returns a new instance of CallMessageQueue.



125
126
127
128
# File 'lib/adhearsion/voip/call.rb', line 125

def initialize
  @open = true
  super
end

Instance Attribute Details

#openObject (readonly)

Returns the value of attribute open.



123
124
125
# File 'lib/adhearsion/voip/call.rb', line 123

def open
  @open
end

Instance Method Details

#<<(queue_obj) ⇒ Object



130
131
132
133
# File 'lib/adhearsion/voip/call.rb', line 130

def <<(queue_obj)
  @open = false if queue_obj == :cancel
  super(queue_obj)
end

#popObject



135
136
137
138
# File 'lib/adhearsion/voip/call.rb', line 135

def pop
  raise Adhearsion::Call::CallMessageQueue::InboxClosedException, "The message queue for this call has aleady been disabled." if !@open
  super
end