Class: BackgroundQueue::ServerLib::PriorityArray

Inherits:
Array
  • Object
show all
Defined in:
lib/background_queue/server_lib/priority_queue.rb

Overview

this is an array with a priority attribute

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(priority) ⇒ PriorityArray

Returns a new instance of PriorityArray.



123
124
125
126
127
# File 'lib/background_queue/server_lib/priority_queue.rb', line 123

def initialize(priority)
  @priority = priority
  raise "Invalid priority" if @priority.nil?
  super(0)
end

Instance Attribute Details

#priorityObject

Returns the value of attribute priority.



122
123
124
# File 'lib/background_queue/server_lib/priority_queue.rb', line 122

def priority
  @priority
end

Instance Method Details

#==(other) ⇒ Object



129
130
131
# File 'lib/background_queue/server_lib/priority_queue.rb', line 129

def ==(other)
  other.priority == self.priority
end

#inspectObject



133
134
135
# File 'lib/background_queue/server_lib/priority_queue.rb', line 133

def inspect
  "#{self.priority}:#{super}"
end