In Files

Included Modules

Gibbler::String

Creates a digest based on: CLASS:LENGTH:VALUE. This method can be used for any class where the to_s method returns an appropriate unique value for this instance. It's used by default for Symbol, Class, Fixnum, and Bignum. e.g.

"str" => String:3:str => 509a839ca1744c72e37759e7684ff0daa3b61427
:sym  => Symbol:3:sym => f3b7b3ca9529002c6826b1ef609d3583c356c8c8

To use use method in other classes simply:

class MyStringLikeClass 
  include Gibbler::String
end

Public Class Methods

included(obj) click to toggle source
# File lib/gibbler.rb, line 403
def self.included(obj)
  obj.extend Attic
  obj.attic :gibbler_cache
end

Public Instance Methods

__gibbler(digest_type=nil) click to toggle source

Creates a digest for the current state of self.

# File lib/gibbler.rb, line 409
def __gibbler(digest_type=nil)
  klass = self.class
  value = self.nil? ? "\00"" : self.to_s
  a = Gibbler.digest "%s:%d:%s" % [klass, value.size, value], digest_type
  gibbler_debug klass, a, [klass, value.size, value]
  a
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.