Class: InfluxDB::MaxQueue

Inherits:
Queue
  • Object
show all
Defined in:
lib/influxdb/max_queue.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(max = 10_000) ⇒ MaxQueue

Returns a new instance of MaxQueue.

Raises:

  • (ArgumentError)


7
8
9
10
11
# File 'lib/influxdb/max_queue.rb', line 7

def initialize(max = 10_000)
  raise ArgumentError, "queue size must be positive" unless max > 0
  @max = max
  super()
end

Instance Attribute Details

#maxObject (readonly)

Returns the value of attribute max.



5
6
7
# File 'lib/influxdb/max_queue.rb', line 5

def max
  @max
end

Instance Method Details

#push(obj) ⇒ Object



13
14
15
# File 'lib/influxdb/max_queue.rb', line 13

def push(obj)
  super if length < @max
end