Module Gibbler::Object
In: lib/gibbler.rb
lib/gibbler/aliases.rb

Methods

Public Class methods

Public Instance methods

Creates a digest for the current state of self based on:

  • Object#class
  • Length of Object#name || 0
  • Object#name || ’’

e.g. Digest::SHA1.hexdigest "Class:6:Object" #=>

This is a default method appropriate for only the most basic objects like Class and Module.

changed?()

Alias for gibbled?

digest(digest_type=nil)

Alias for gibbler

The cache is in the Attic.

digest_fields()

Alias for gibbler_fields

A simple override on Object#freeze to create a digest before the object is frozen. Once the object is frozen obj.gibbler will return the cached value with out calculation.

Has this object been modified?

This method compares the return value from digest with the previous value returned by gibbler (the value is stored in the attic as gibbler_cache). See Attic

Calculates a digest for the current object instance. Objects that are a kind of Hash or Array are processed recursively. The length of the returned String depends on the digest type. Also stores the value in the attic.

    obj.gibbler          # => a5b1191a
    obj.gibbler_cache    # => a5b1191a

Calling gibbler_cache returns the most recent digest without calculation.

If the object is frozen, this will return the value of gibbler_cache.

[Validate]