Class: WindowBlessing::EventQueue

Inherits:
Object
  • Object
show all
Defined in:
lib/window_blessing/event_queue.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeEventQueue

Returns a new instance of EventQueue.



5
6
7
# File 'lib/window_blessing/event_queue.rb', line 5

def initialize
  @queue = []
end

Instance Attribute Details

#queueObject

Returns the value of attribute queue.



3
4
5
# File 'lib/window_blessing/event_queue.rb', line 3

def queue
  @queue
end

Instance Method Details

#<<(a) ⇒ Object



9
10
11
12
13
14
# File 'lib/window_blessing/event_queue.rb', line 9

def <<(a)
  case a
  when Array then @queue += a
  else @queue << a
  end
end

#clearObject



16
# File 'lib/window_blessing/event_queue.rb', line 16

def clear; @queue = [] end

#empty?Boolean

Returns:

  • (Boolean)


18
# File 'lib/window_blessing/event_queue.rb', line 18

def empty?; @queue.length == 0 end

#pop_allObject



17
# File 'lib/window_blessing/event_queue.rb', line 17

def pop_all; @queue.tap {clear} end