Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/delano/hexoid

Generate Ruby style object ids
https://github.com/delano/hexoid

Last synced: 2 months ago
JSON representation

Generate Ruby style object ids

Awesome Lists containing this project

README

        

= Hexoid v0.2

Generate Ruby style object ids

The default to_s method for Ruby objects includes the object id encoded as a hexadecimal: #. 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 # => ""
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

* Codes[http://github.com/delano/hexoid]
* RDocs[http://delano.github.com/hexoid]
* Story[http://solutious.com/blog/2009/09/22/secret-of-object-to_s/]

== Credits

* Delano Mandelbaum (http://solutious.com)

== License

See LICENSE.txt