Class: WindowBlessing::EventQueue
- Inherits:
-
Object
- Object
- WindowBlessing::EventQueue
- Defined in:
- lib/window_blessing/event_queue.rb
Instance Attribute Summary collapse
-
#queue ⇒ Object
Returns the value of attribute queue.
Instance Method Summary collapse
- #<<(a) ⇒ Object
- #clear ⇒ Object
- #empty? ⇒ Boolean
-
#initialize ⇒ EventQueue
constructor
A new instance of EventQueue.
- #pop_all ⇒ Object
Constructor Details
#initialize ⇒ EventQueue
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
#queue ⇒ Object
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 |
#clear ⇒ Object
16 |
# File 'lib/window_blessing/event_queue.rb', line 16 def clear; @queue = [] end |
#empty? ⇒ Boolean
18 |
# File 'lib/window_blessing/event_queue.rb', line 18 def empty?; @queue.length == 0 end |
#pop_all ⇒ Object
17 |
# File 'lib/window_blessing/event_queue.rb', line 17 def pop_all; @queue.tap {clear} end |