Module: Gibbler::Time
Overview
Creates a digest based on: CLASS:LENGTH:TIME
. Times are calculated based on the equivalent time in UTC. e.g.
Time.parse('2009-08-25 16:43:53 UTC') => 73b4635f
Time.parse('2009-08-25 12:43:53 -04:00') => 73b4635f
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
522 523 524 525 |
# File 'lib/gibbler.rb', line 522 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.
528 529 530 531 532 533 534 |
# File 'lib/gibbler.rb', line 528 def __gibbler(digest_type=nil) klass = self.class value = self.nil? ? "\0" : self.utc.strftime('%Y-%m-%d %H:%M:%S UTC') a = Gibbler.digest "%s:%d:%s" % [klass, value.size, value], digest_type gibbler_debug klass, a, [klass, value.size, value] a end |