The <=> should return nil if the objects are not comparable, but it currently returns false, which causes errors.
Also, checking against the existance of to_i would make things more flexible: e.g.
# Compare this duration to another (or objects that respond to #to_i)
def <=>(other)
return nil unless other.respond_to?(:to_i)
@total <=> other.to_i
end