Skip to content
Generate Ruby style object ids
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
tryouts
CHANGES.txt
LICENSE.txt
README.rdoc
Rakefile
hexoid.gemspec

README.rdoc

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
    "<%s:%s>" % [self.class.name, 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

License

See LICENSE.txt

You can’t perform that action at this time.