Module: Gibbler::DateTime
Overview
Creates a digest based on: CLASS:LENGTH:DATETIME
. Dates are calculated based on the equivalent datetime in UTC. e.g.
DateTime.parse('2009-08-25T17:00:40+00:00') => ad64c769
DateTime.parse('2009-08-25T13:00:40-04:00') => ad64c769
To use use method in other classes simply:
class ClassLikeTime
include Gibbler::Time
end
Class Method Summary collapse
Instance Method Summary collapse
-
#__gibbler(digest_type = nil) ⇒ Object
Creates a digest for the current state of self.
Methods included from Object
#digest_cache, #freeze, #gibbled?, #gibbler, #gibbler_debug, #gibbler_fields, gibbler_fields
Class Method Details
.included(obj) ⇒ Object
510 511 512 513 |
# File 'lib/gibbler.rb', line 510 def self.included(obj) obj.extend Attic obj.attic :gibbler_cache end |
Instance Method Details
#__gibbler(digest_type = nil) ⇒ Object
Creates a digest for the current state of self.
516 517 518 519 520 521 522 |
# File 'lib/gibbler.rb', line 516 def __gibbler(digest_type=nil) klass = self.class value = self.nil? ? "\0" : self.new_offset(0).to_s a = Gibbler.digest "%s:%d:%s" % [klass, value.size, value], digest_type gibbler_debug klass, a, [klass, value.size, value] a end |