Class: Holistic::Ruby::TypeInference::ProcessingQueue
- Inherits:
-
Object
- Object
- Holistic::Ruby::TypeInference::ProcessingQueue
- Defined in:
- lib/holistic/ruby/type_inference/processing_queue.rb
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize ⇒ ProcessingQueue
constructor
A new instance of ProcessingQueue.
- #pop ⇒ Object
- #push(item) ⇒ Object
- #push_with_high_priority(item) ⇒ Object
Constructor Details
#initialize ⇒ ProcessingQueue
Returns a new instance of ProcessingQueue.
5 6 7 8 |
# File 'lib/holistic/ruby/type_inference/processing_queue.rb', line 5 def initialize @high_priority_queue = ::Queue.new @queue = ::Queue.new end |
Instance Method Details
#empty? ⇒ Boolean
18 19 20 |
# File 'lib/holistic/ruby/type_inference/processing_queue.rb', line 18 def empty? @high_priority_queue.empty? && @queue.empty? end |
#pop ⇒ Object
22 23 24 25 26 |
# File 'lib/holistic/ruby/type_inference/processing_queue.rb', line 22 def pop return @high_priority_queue.pop if @high_priority_queue.size > 0 @queue.pop end |
#push(item) ⇒ Object
10 11 12 |
# File 'lib/holistic/ruby/type_inference/processing_queue.rb', line 10 def push(item) @queue.push(item) end |
#push_with_high_priority(item) ⇒ Object
14 15 16 |
# File 'lib/holistic/ruby/type_inference/processing_queue.rb', line 14 def push_with_high_priority(item) @high_priority_queue.push(item) end |