Class: Queue

Inherits:
Object
  • Object
show all
Defined in:
lib/chinese_vocab/core_ext/queue.rb

Instance Method Summary collapse

Instance Method Details

#pop!Object

Return nil if queue is empty.



12
13
14
15
16
17
18
19
20
21
# File 'lib/chinese_vocab/core_ext/queue.rb', line 12

def pop!
  pop(non_block = true)
rescue ThreadError => e
  case e.message
  when /queue empty/
    nil
  else
    raise
  end
end

#to_aObject



7
8
9
# File 'lib/chinese_vocab/core_ext/queue.rb', line 7

def to_a
  @que
end