Sha256: e10100fa1e15f4a691449683c94e67f3198c91bf9285a7c0f701cf02ebf79310
Contents?: true
Size: 565 Bytes
Versions: 10
Compression:
Stored size: 565 Bytes
Contents
# -*- encoding: utf-8 -*- # -*- frozen_string_literal: true -*- # -*- warn_indent: true -*- module UnitMeasurements module Comparison include Comparable # Implements +Comparable+ methods on the quantities of two measurements of # the same unit group. # # @example # UnitMeasurements::Weight.new(1, "kg") == UnitMeasurements::Weight.new(1, :kg) # => true # # @return [Boolean] def <=>(object) return nil unless object.is_a?(self.class) quantity <=> object.convert_to(unit.name).quantity end end end
Version data entries
10 entries across 10 versions & 1 rubygems