Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Support non-string keys #1

Closed
eric opened this issue Mar 19, 2012 · 2 comments
Closed

Feature Request: Support non-string keys #1

eric opened this issue Mar 19, 2012 · 2 comments

Comments

@eric
Copy link
Contributor

eric commented Mar 19, 2012

I am looking for a key-value data structure where the keys (floats) are naturally sorted for my metriks gem.

I am currently using RBTree but would like to use something without native code (to allow it to be used in JRuby, etc).

The class I am using it in is here: https://github.com/eric/metriks/blob/master/lib/metriks/exponentially_decaying_sample.rb

Would you take a pull request that removed the instances of calling .to_s on the keys?

@nahi
Copy link
Owner

nahi commented Mar 19, 2012

Yes! I forgot I added key.to_s there. The code is derived from https://github.com/nahi/radix_tree/blob/master/lib/radix_tree.rb which only supports String key. Comparable is enough for key in AVLTree and RedBlackTree... It's simply a bug. Thanks for finding it.

I'll wait a pull request to record the credit to you.

@nahi
Copy link
Owner

nahi commented Mar 19, 2012

See #2. Fixed now.

@nahi nahi closed this as completed Mar 19, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants