Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/delano/hexoid
- Owner: delano
- License: mit
- Created: 2009-09-21T23:50:19.000Z (over 15 years ago)
- Default Branch: master
- Last Pushed: 2010-07-29T09:09:01.000Z (over 14 years ago)
- Last Synced: 2024-05-01T23:13:25.774Z (8 months ago)
- Language: Ruby
- Homepage: http://solutious.com/blog/2009/09/22/secret-of-object-to_s/
- Size: 137 KB
- Stars: 3
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.rdoc
- Changelog: CHANGES.txt
- License: LICENSE.txt
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"
== InstallationGet 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