class ActiveSupport::Duration::Scalar
def -(other)
def -(other) if Duration === other seconds = value - other.parts[:seconds] new_parts = other.parts.map { |part, other_value| [part, -other_value] }.to_h new_parts = new_parts.merge(seconds: seconds) new_value = value - other.value Duration.new(new_value, new_parts) else calculate(:-, other) end end