Sha256: b79081ed58921520fb58aeb47e6714a8c362bff8b620b7a83d8c62d586d876ea

Contents?: true

Size: 492 Bytes

Versions: 1

Compression:

Stored size: 492 Bytes

Contents

# frozen_string_literal: true

module Vnstat
  class Result
    ##
    # A module that is included by result types that can be compared based
    # on their particular time information.
    module TimeComparable
      ##
      # @return [Integer, nil]
      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
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vnstat-ruby-2.0.0 lib/vnstat/result/time_comparable.rb