Sha256: 7e4817d29e8a9ebf31f60dac042c2120d28c2a458c51231f199b67f22763c9ac
Contents?: true
Size: 548 Bytes
Versions: 14
Compression:
Stored size: 548 Bytes
Contents
# This file is part of the "Utopia Framework" project, and is licensed under the GNU AGPLv3. # Copyright 2010 Samuel Williams. All rights reserved. # See <utopia.rb> for licensing details. require 'date' class Date alias_method :old_cmp, :<=> def <=> (other) # Comparing a Date with something that has a time component truncates the time # component, thus we need to check if the other object has a more exact comparison # function. if other.respond_to?(:hour) return (other <=> self) * -1 else old_cmp(other) end end end
Version data entries
14 entries across 14 versions & 1 rubygems