ordered_hash
Version, currently main branch1 version
- main branchlatestJun 18, 2025
github.com/plambert/ordered_hash.cr
A simple ordered hash implementation for Crystal
1 stars
0 dependents
License: MIT
Installation
# Add this to your shard.yml
dependencies:
ordered_hash:
github: plambert/ordered_hash.cr
branch: mainmain is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
>= 1.16.3- License
- MIT
- Author
- Paul M. Lambert
Dependencies
This version declares no dependencies.
README
OrderedHash
A Crystal class that acts as a Hash, but remembers the order of key inserts and returns the keys in that same order.
Installation
-
Add the dependency to your
shard.yml:dependencies: ordered_hash: github: plambert/ordered_hash.cr -
Run
shards install
Usage
require "ordered_hash"
hash = OrderedHash(String, String).new
hash["wednesday"] = "piano lesson"
hash["thursday"] = "guitar lesson"
hash.keys # ==> ["wednesday", "thursday"] # _always_ will return in this order!
new_hash = hash.sort
new_hash.keys # ==> ["thursday", "wednesday"] # the keys have been sorted, so will _always_ return in this order
Development
TODO: Write development instructions here
Contributing
- Fork it (https://github.com/plambert/ordered_hash.cr/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- Paul M. Lambert - creator and maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
main- Seen
- Jun 18, 2025
- Crystal
>= 1.16.3- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/plambert/ordered_hash.cr
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 15, 2026
- Synced
- Aug 15, 2026
- Versions
- 1