Hexoid v0.2
Generate Ruby style object ids
The default to_s
method for Ruby objects includes the object id encoded as a hexadecimal: #<Object:0x000001009e60f8>
. When you add a to_s
method to your own objects, you lose that hexadecimal value. Hexoid gives it back.
Usage
require 'hexoid'
class A
def to_s
"<A:%s>" % self.hexoid
end
end
obj = A.new
puts obj # => "<A:0x10103a380>"
puts obj.hexoid # => "0x10103a380"
Installation
Get it in one of the following ways:
-
gem install hexoid
-
git clone git://github.com/delano/hexoid.git
-
gem install delano-hexoid --source http://gems.github.com
Known Issues
-
Does not work in JRuby
More Information
Credits
-
Delano Mandelbaum (solutious.com)
License
See LICENSE.txt