Class: Punchblock::Component::ComponentNode

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber-voip/core_ext/punchblock/component/component_node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ ComponentNode

Returns a new instance of ComponentNode.



6
7
8
9
10
11
12
# File 'lib/cucumber-voip/core_ext/punchblock/component/component_node.rb', line 6

def initialize(*args)
  super
  @event_queue = Queue.new
  register_event_handler do |event|
    @event_queue << event
  end
end

Instance Attribute Details

#event_queueObject

Returns the value of attribute event_queue.



4
5
6
# File 'lib/cucumber-voip/core_ext/punchblock/component/component_node.rb', line 4

def event_queue
  @event_queue
end

Instance Method Details

#next_event(timeout = nil) ⇒ Object



14
15
16
# File 'lib/cucumber-voip/core_ext/punchblock/component/component_node.rb', line 14

def next_event(timeout = nil)
  Timeout::timeout(timeout) { event_queue.pop }
end