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

Ordered Hash for the EnumHash class. #2

Closed
dmitry opened this issue Apr 11, 2010 · 4 comments
Closed

Ordered Hash for the EnumHash class. #2

dmitry opened this issue Apr 11, 2010 · 4 comments

Comments

@dmitry
Copy link
Contributor

dmitry commented Apr 11, 2010

I have a problem with the sorting the enum keys. I think the hash of keys should be in the assignment order. So my suggestion is to change:

class EnumHash < ::Hash

to

class EnumHash < ::ActiveSupport::OrderedHash

or something similar.

PS. Right now I'm doing something like that:

Price.names.values.sort.map do |name|
  name = Price.names.invert[name]
  # here is the code
end
@lwe
Copy link
Owner

lwe commented Apr 11, 2010

mhh, good point... feel free to go ahead, test & implement it

@lwe
Copy link
Owner

lwe commented Apr 12, 2010

ps: i'm working on it

@lwe
Copy link
Owner

lwe commented Apr 12, 2010

fixed, ebfd101

@dmitry
Copy link
Contributor Author

dmitry commented Apr 12, 2010

Wow, so fast. Thanks!

This issue was closed.
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