Class: TimeQueue::Item

Inherits:
Struct
  • Object
show all
Defined in:
lib/argus/time_queue.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#timeObject

Returns the value of attribute time

Returns:

  • (Object)

    the current value of time


2
3
4
# File 'lib/argus/time_queue.rb', line 2

def time
  @time
end

#valueObject

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value


2
3
4
# File 'lib/argus/time_queue.rb', line 2

def value
  @value
end

Instance Method Details

#<=>(other) ⇒ Object


3
4
5
# File 'lib/argus/time_queue.rb', line 3

def <=>(other)
  time <=> other.time
end

#keyObject


7
8
9
# File 'lib/argus/time_queue.rb', line 7

def key
  object_id
end

#to_s(basetime = nil) ⇒ Object


11
12
13
14
15
16
17
# File 'lib/argus/time_queue.rb', line 11

def to_s(basetime=nil)
  if basetime
    "#{value.inspect}@+#{time-basetime}"
  else
    "#{value.inspect}@#{time.strftime('%H:%M:%S.%L')}"
  end
end