Module: Vnstat::Result::TimeComparable

Included in:
Hour, Minute
Defined in:
lib/vnstat/result/time_comparable.rb

Overview

A module that is included by result types that can be compared based on their particular time information.

Instance Method Summary collapse

Instance Method Details

#<=>(other) ⇒ Integer?

Returns:

  • (Integer, nil)


11
12
13
14
15
16
# File 'lib/vnstat/result/time_comparable.rb', line 11

def <=>(other)
  return nil unless other.respond_to?(:bytes_transmitted)
  return nil unless other.respond_to?(:time)

  [time, bytes_transmitted] <=> [other.time, other.bytes_transmitted]
end