Skip to content

Commit

Permalink
ADDED: Out of the box support for Regexp (Gibbler::String)
Browse files Browse the repository at this point in the history
  • Loading branch information
delano committed Oct 7, 2009
1 parent 961896c commit b12fb28
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 85 deletions.
2 changes: 1 addition & 1 deletion CHANGES.txt
Expand Up @@ -10,7 +10,7 @@ GIBBLER, CHANGES
* CHANGE: Gibbler::Object#gibbler returns the value of gibbler_cache when
the object is frozen, without calculation.
* ADDED: Gibbler::Object#freeze to create digest before freezing.

* ADDED: Out of the box support for Regexp (Gibbler::String)

#### 0.6.3 (2009-09-30) #################################

Expand Down
16 changes: 8 additions & 8 deletions README.rdoc
Expand Up @@ -127,12 +127,16 @@ Gibbler::String creates a digest based on the name of the class and the output o
This code is hella fresh (est 2009-06-25). It's barely tested and the interface may change, but it's fun to play with. I'll happily accept patches. Some things to keep in mind:

* Gibbler history is not suitable for very large objects since it keeps complete copies of the object in memory. This is a very early implementation of this feature so don't rely on it for production code.
* Digest calculation may change between non-trivial releases.
* There has been very little testing for concurrency issues. (Anyone interested?)

* Digest calculation may change between minor releases (e.g. 0.5 to 0.6, etc)

== News

=== 2009-10-07: Support for freezing and Regexp

In 0.6.4, all Gibbler objects will create a new digest when <tt>obj.freeze</tt> is called. All subsequent calls to <tt>obj.gibbler</tt> will return the most recent digest without having to run the calculation again.

I've also added support for Regexp out of the box.

=== 2009-07-20: Digest change for instances of Class, Module, and Proc

Digest calculation has changed for Class, Module, and Proc objects. Digests created with Gibbler 0.5.x and earlier will not match the ones created by 0.6.
Expand All @@ -142,15 +146,11 @@ Digest calculation has changed for Class, Module, and Proc objects. Digests crea

Also note that this change affects the digests for Hashes and Arrays that contain instances of Class, Module, or Proc.

=== 2009-07-17: Improved support for Symbol and Fixnum

With the upgrade to Attic 0.4, the gibbled? method and object history is now available for Symbol and Fixnum objects.


== Known Issues

* gibbler or gibbled? must be called at least once before gibbled? will be able to return a useful value (otherwise there is no previous digest value to compare to)
* Digests for Bignum objects are different between Ruby 1.8, 1.9, and JRuby. Does anyone know why?
* Digests for Bignum objects are different between Ruby and JRuby. Does anyone know why?
* Digests for Proc objects are different between Ruby 1.8 and 1.9 because Proc.arity returns different values and 1.8 has no lambda? method.


Expand Down
97 changes: 21 additions & 76 deletions lib/gibbler.rb
Expand Up @@ -434,84 +434,29 @@ def __gibbler(h=self)

end

class Proc
include Gibbler::Block
end

class Hash
include Gibbler::Hash
end

class Array
include Gibbler::Array
end

class String
include Gibbler::String
end

class Symbol
include Gibbler::String
end
class Proc; include Gibbler::Block; end
class Hash; include Gibbler::Hash; end
class Array; include Gibbler::Array; end
class String; include Gibbler::String; end
class Symbol; include Gibbler::String; end
class Class; include Gibbler::Object; end
class Module; include Gibbler::Object; end
class Fixnum; include Gibbler::String; end
class Bignum; include Gibbler::String; end
class TrueClass; include Gibbler::String; end
class FalseClass; include Gibbler::String; end
class Float; include Gibbler::String; end
class Time; include Gibbler::Time; end
class Date; include Gibbler::String; end
class DateTime < Date; include Gibbler::DateTime; end
class Range; include Gibbler::Range; end
class NilClass; include Gibbler::Nil; end
module URI; class Generic; include Gibbler::String; end; end
class File; include Gibbler::File; end
class TempFile; include Gibbler::File; end
class Regexp; include Gibbler::String; end

class Class
include Gibbler::Object
end

class Module
include Gibbler::Object
end

class Fixnum
include Gibbler::String
end

class Bignum
include Gibbler::String
end

class TrueClass
include Gibbler::String
end

class FalseClass
include Gibbler::String
end

class Float
include Gibbler::String
end

class Time
include Gibbler::Time
end

class Date
include Gibbler::String
end

class DateTime < Date
include Gibbler::DateTime
end

class Range
include Gibbler::Range
end

class NilClass
include Gibbler::Nil
end

module URI
class Generic
include Gibbler::String
end
end

class File
include Gibbler::File
end

class TempFile
include Gibbler::File
end
1 change: 1 addition & 0 deletions lib/gibbler/object.rb
Expand Up @@ -62,6 +62,7 @@ def gibbler_debug(*args)
def __gibbler(h=self)
klass = h.class
nom = h.name || ''

a = Gibbler.digest '%s:%s:%s' % [klass, nom.size, nom]
gibbler_debug klass, a, [klass, nom.size, nom]
a
Expand Down

0 comments on commit b12fb28

Please sign in to comment.