Sha256: 366d922c0996fb330a9b1e4e04e99043a6abf856fc4d4f12a79ad317fd141a14

Contents?: true

Size: 461 Bytes

Versions: 7

Compression:

Stored size: 461 Bytes

Contents

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

7 entries across 7 versions & 1 rubygems

Version Path
vnstat-ruby-1.1.0 lib/vnstat/result/time_comparable.rb
vnstat-ruby-1.0.5 lib/vnstat/result/time_comparable.rb
vnstat-ruby-1.0.4 lib/vnstat/result/time_comparable.rb
vnstat-ruby-1.0.3 lib/vnstat/result/time_comparable.rb
vnstat-ruby-1.0.2 lib/vnstat/result/time_comparable.rb
vnstat-ruby-1.0.1 lib/vnstat/result/time_comparable.rb
vnstat-ruby-1.0.0 lib/vnstat/result/time_comparable.rb