Class: Adhearsion::Calls
- Inherits:
-
Hash
- Object
- Hash
- Adhearsion::Calls
- Includes:
- Celluloid
- Defined in:
- lib/adhearsion/calls.rb
Overview
This manages the list of calls the Adhearsion service receives
Instance Method Summary (collapse)
- - (Object) <<(call)
- - (Object) from_offer(offer)
- - (Object) remove_inactive_call(call)
- - (Object) with_tag(tag)
Methods included from Celluloid
Instance Method Details
- (Object) <<(call)
17 18 19 20 21 |
# File 'lib/adhearsion/calls.rb', line 17 def <<(call) link call self[call.id] = call current_actor end |
- (Object) from_offer(offer)
11 12 13 14 15 |
# File 'lib/adhearsion/calls.rb', line 11 def from_offer(offer) Call.new(offer).tap do |call| self << call end end |
- (Object) remove_inactive_call(call)
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/adhearsion/calls.rb', line 23 def remove_inactive_call(call) if call_is_dead?(call) != nil call_id = key call delete call_id if call_id elsif call.respond_to?(:id) delete call.id else delete call end end |
- (Object) with_tag(tag)
34 35 36 37 38 |
# File 'lib/adhearsion/calls.rb', line 34 def with_tag(tag) values.find_all do |call| call.tagged_with? tag end end |