Sha256: aee1942d76f2fda7397b10e57d075649459f1897c3065b7174bb20ec51aec0c5

Contents?: true

Size: 532 Bytes

Versions: 1

Compression:

Stored size: 532 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.

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

1 entries across 1 versions & 1 rubygems

Version Path
utopia-0.9.41 lib/utopia/extensions/date.rb