Class: Holistic::Ruby::TypeInference::ProcessingQueue

Inherits:
Object
  • Object
show all
Defined in:
lib/holistic/ruby/type_inference/processing_queue.rb

Instance Method Summary collapse

Constructor Details

#initializeProcessingQueue

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

Returns:

  • (Boolean)


18
19
20
# File 'lib/holistic/ruby/type_inference/processing_queue.rb', line 18

def empty?
  @high_priority_queue.empty? && @queue.empty?
end

#popObject



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