D
Delano Mandelbaum
Gibbler 0.5 ALPHA
Git-like hashes and history for Ruby objects.
Installation:
$ gem install gibbler
Examples:
require 'gibbler'
"kimmy".gibbler # => c8027100
:kimmy.gibbler # => 52be7494
config = {}
config.gibbler # => 4fdcadc6
config.gibbled? # => false
config[:server] = {
:users => [:dave, :ali],
orts => [22, 80, 443]
}
config.gibbled? # => true
config.gibbler # => ef23d605
config[:server][:users] << :yanni
config.gibbler # => 4c558a56
config.gibbler.short # => 4c558a56
Gibbler can also keep track of the history of changes to an object. By
default Gibbler supports history for Hash, Array, and String objects.
The gibbler_commit method creates a clone of the current object and
stores it in an instance variable using the current hash digest as the
key.
require 'gibbler'
require 'gibbler/history'
a = { :magic => riginal }
a.gibbler_commit # => d7049916
a[:magic] = :updated
a.gibbler_commit # => b668098e
a[:magic] = :changed
a.gibbler_commit # => 0b11c377
a.gibbler_history # => d7049916, b668098e, 0b11c377
a.gibbler_revert! 'd7049916' # Return to a specific commit
a.gibbler # => d7049916
a # => { :magic => riginal }
a.delete :magic
a.gibbler_revert! # Return to the previous commit
a.gibbler # => 0b11c377
a # => { :magic => :changed }
a.gibbler_object 'b668098e' # => { :magic => :updated }
a.gibbler_stamp # => 2009-07-01 18:56:52 -0400
Codes: http://github.com/delano/gibbler/
RDocs: http://delano.github.com/gibbler/
Git-like hashes and history for Ruby objects.
Installation:
$ gem install gibbler
Examples:
require 'gibbler'
"kimmy".gibbler # => c8027100
:kimmy.gibbler # => 52be7494
config = {}
config.gibbler # => 4fdcadc6
config.gibbled? # => false
config[:server] = {
:users => [:dave, :ali],
orts => [22, 80, 443]
}
config.gibbled? # => true
config.gibbler # => ef23d605
config[:server][:users] << :yanni
config.gibbler # => 4c558a56
config.gibbler.short # => 4c558a56
Gibbler can also keep track of the history of changes to an object. By
default Gibbler supports history for Hash, Array, and String objects.
The gibbler_commit method creates a clone of the current object and
stores it in an instance variable using the current hash digest as the
key.
require 'gibbler'
require 'gibbler/history'
a = { :magic => riginal }
a.gibbler_commit # => d7049916
a[:magic] = :updated
a.gibbler_commit # => b668098e
a[:magic] = :changed
a.gibbler_commit # => 0b11c377
a.gibbler_history # => d7049916, b668098e, 0b11c377
a.gibbler_revert! 'd7049916' # Return to a specific commit
a.gibbler # => d7049916
a # => { :magic => riginal }
a.delete :magic
a.gibbler_revert! # Return to the previous commit
a.gibbler # => 0b11c377
a # => { :magic => :changed }
a.gibbler_object 'b668098e' # => { :magic => :updated }
a.gibbler_stamp # => 2009-07-01 18:56:52 -0400
Codes: http://github.com/delano/gibbler/
RDocs: http://delano.github.com/gibbler/