Skip to content

Instantly share code, notes, and snippets.

@jgn
Created April 10, 2011 03:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jgn/912016 to your computer and use it in GitHub Desktop.
Save jgn/912016 to your computer and use it in GitHub Desktop.
OrderedSet leveraging ActiveSupport::OrderedHash to get predictable behavior across 1.8.x, 1.9.x
# Force the underlying store for a Set to be an OrderedHash.
class OrderedSet < Set
def initialize(enum = nil, &block)
@hash ||= ActiveSupport::OrderedHash.new
super
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment