https://github.com/mame/rbtree
A source code mirror of [rbtree gem](https://rubygems.org/gems/rbtree). This repository is for making it easy for me (@mame) to maintain the rbtree gem. We will not accept any feature proposal. The primary repository of rbtree gem is private, and managed by OZAWA Takuma, the original author of the gem.
https://github.com/mame/rbtree
Keywords from Contributors
activejob activerecord mvc repl documentation-tool rubygems json-parser strscan lalr-parser-generator parser-generator
Last synced: about 3 hours ago
JSON representation
Repository metadata
A source code mirror of [rbtree gem](https://rubygems.org/gems/rbtree). This repository is for making it easy for me (@mame) to maintain the rbtree gem. We will not accept any feature proposal. The primary repository of rbtree gem is private, and managed by OZAWA Takuma, the original author of the gem.
- Host: GitHub
- URL: https://github.com/mame/rbtree
- Owner: mame
- License: mit
- Created: 2022-01-31T07:25:32.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2026-06-26T07:48:00.000Z (3 months ago)
- Last Synced: 2026-08-18T16:19:02.676Z (about 1 month ago)
- Language: C
- Homepage:
- Size: 41 KB
- Stars: 19
- Watchers: 2
- Forks: 4
- Open Issues: 2
- Releases: 0
-
Metadata Files:
- Readme: README
- License: LICENSE
README
= Ruby/RBTree
== Description
A RBTree is a sorted associative collection that is implemented with a
Red-Black Tree. It maps keys to values like a Hash, but maintains its
elements in ascending key order. The interface is the almost identical
to that of Hash.
A Red-Black Tree is a kind of binary tree that automatically balances
by itself when a node is inserted or deleted. Lookup, insertion, and
deletion are performed in O(log N) time in the expected and worst
cases. On the other hand, the average case complexity of
lookup/insertion/deletion on a Hash is constant time. A Hash is
usually faster than a RBTree where ordering is unimportant.
The elements of a RBTree are sorted using the <=> method of their keys
or a Proc set by the readjust method. It means all keys should be
comparable with each other or a Proc that takes two keys should return
a negative integer, 0, or a positive integer as the first argument is
less than, equal to, or greater than the second one.
RBTree also provides a few additional methods to take advantage of the
ordering:
* lower_bound, upper_bound, bound
* first, last
* shift, pop
* reverse_each
== Example
A RBTree cannot contain duplicate keys. Use MultiRBTree that is the
parent class of RBTree to store duplicate keys.
require "rbtree"
rbtree = RBTree["c", 10, "a", 20]
rbtree["b"] = 30
p rbtree["b"] # => 30
rbtree.each do |k, v|
p [k, v]
end # => ["a", 20] ["b", 30] ["c", 10]
mrbtree = MultiRBTree["c", 10, "a", 20, "e", 30, "a", 40]
p mrbtree.lower_bound("b") # => ["c", 10]
mrbtree.bound("a", "d") do |k, v|
p [k, v]
end # => ["a", 20] ["a", 40] ["c", 10]
Note: a RBTree cannot be modified during iteration.
== Installation
Run the following command.
$ sudo gem install rbtree
== Changes
=== 0.4.7
* Use the typed data API, as the untyped data API will be removed in Ruby 4.1.
=== 0.4.6
* Make it work with clang 15.
=== 0.4.5
* Support Ruby 3.2.0-dev (development branch).
=== 0.4.4
* Remove the rb_safe_level warning on Ruby 2.7.
=== 0.4.3
* Quick bug fixes for Ruby 3.
== License
MIT License. Copyright (c) 2002-2013 OZAWA Takuma.
dict.c and dict.h are modified copies that are originally in Kazlib
1.20 written by Kaz Kylheku. Its license is similar to the MIT
license. See dict.c and dict.h for the details. The web page of Kazlib
is at http://www.kylheku.com/~kaz/kazlib.html.
Owner metadata
- Name: Yusuke Endoh
- Login: mame
- Email:
- Kind: user
- Description: World No.1 IOCCC player. http://www.ioccc.org/winners.html#Yusuke_Endoh
- Website: http://mametter.hatenablog.com/
- Location: Japan
- Twitter: mametter
- Company: @heyinc
- Icon url: https://avatars.githubusercontent.com/u/21557?v=4
- Repositories: 176
- Last ynced at: 2024-04-14T17:32:24.551Z
- Profile URL: https://github.com/mame
GitHub Events
Total
- Fork event: 1
- Issue comment event: 5
- Issues event: 1
- Pull request event: 1
- Push event: 2
- Watch event: 1
Last Year
- Issue comment event: 2
- Push event: 2
Committers metadata
Last synced: about 17 hours ago
Total Commits: 24
Total Committers: 3
Avg Commits per committer: 8.0
Development Distribution Score (DDS): 0.375
Commits in past year: 10
Committers in past year: 3
Avg Commits per committer in past year: 3.333
Development Distribution Score (DDS) in past year: 0.2
| Name | Commits | |
|---|---|---|
| Yusuke Endoh | m****e@r****g | 15 |
| Nobuyoshi Nakada | n****u@r****g | 8 |
| OKURA Masafumi | m****8@g****m | 1 |
Committer domains:
Issue and Pull Request metadata
Last synced: 1 day ago
Total issues: 3
Total pull requests: 10
Average time to close issues: 2 days
Average time to close pull requests: 4 months
Total issue authors: 3
Total pull request authors: 4
Average comments per issue: 4.0
Average comments per pull request: 0.8
Merged pull request: 7
Bot issues: 0
Bot pull requests: 0
Past year issues: 0
Past year pull requests: 5
Past year average time to close issues: N/A
Past year average time to close pull requests: about 2 months
Past year issue authors: 0
Past year pull request authors: 1
Past year average comments per issue: 0
Past year average comments per pull request: 0.2
Past year merged pull request: 4
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- bf4 (1)
- chytreg (1)
- headius (1)
Top Pull Request Authors
- nobu (5)
- okuramasafumi (2)
- mame (2)
- headius (1)
Top Issue Labels
Top Pull Request Labels
Package metadata
- Total packages: 11
-
Total downloads:
- rubygems: 142,328,240 total
- Total docker downloads: 872,160,106
- Total dependent packages: 19 (may contain duplicates)
- Total dependent repositories: 1,217 (may contain duplicates)
- Total versions: 31
- Total maintainers: 3
gem.coop: rbtree
A RBTree is a sorted associative collection that is implemented with a Red-Black Tree. It maps keys to values like a Hash, but maintains its elements in ascending key order. The interface is the almost identical to that of Hash.
- Homepage: https://github.com/mame/rbtree
- Documentation: http://www.rubydoc.info/gems/rbtree/
- Licenses: MIT
- Latest release: 0.4.7 (published 3 months ago)
- Last Synced: 2026-09-22T14:44:01.084Z (1 day ago)
- Versions: 11
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 71,164,120 Total
- Docker Downloads: 436,080,053
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 0.184%
- Docker downloads count: 0.276%
- Downloads: 0.461%
- Maintainers (2)
rubygems.org: rbtree
A RBTree is a sorted associative collection that is implemented with a Red-Black Tree. It maps keys to values like a Hash, but maintains its elements in ascending key order. The interface is the almost identical to that of Hash.
- Homepage: https://github.com/mame/rbtree
- Documentation: http://www.rubydoc.info/gems/rbtree/
- Licenses: MIT
- Latest release: 0.4.7 (published 3 months ago)
- Last Synced: 2026-09-22T14:44:01.924Z (1 day ago)
- Versions: 11
- Dependent Packages: 19
- Dependent Repositories: 1,217
- Downloads: 71,164,120 Total
- Docker Downloads: 436,080,053
-
Rankings:
- Docker downloads count: 0.338%
- Downloads: 0.483%
- Average: 0.709%
- Dependent repos count: 0.923%
- Dependent packages count: 1.094%
- Maintainers (2)
ubuntu-23.10: ruby-rbtree
- Homepage: https://github.com/mame/rbtree
- Licenses: mit
- Latest release: 0.4.6-1 (published 7 months ago)
- Last Synced: 2026-08-22T17:31:02.812Z (about 1 month ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
debian-12: ruby-rbtree
- Homepage: https://github.com/mame/rbtree
- Documentation: https://packages.debian.org/bookworm/ruby-rbtree
- Licenses: mit
- Latest release: 0.4.6-1 (published 7 months ago)
- Last Synced: 2026-03-13T04:21:20.797Z (6 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
openbsd-7.9-amd64: devel/ruby-rbtree,ruby33
sorted associative collection
- Homepage: https://github.com/mame/rbtree
- Licenses: mit
- Latest release: 0.4.6 (published 5 months ago)
- Last Synced: 2026-09-17T18:30:20.993Z (6 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
- Maintainers (1)
openbsd-7.9-amd64: devel/ruby-rbtree,ruby40
sorted associative collection
- Homepage: https://github.com/mame/rbtree
- Licenses: mit
- Latest release: 0.4.6 (published 5 months ago)
- Last Synced: 2026-08-01T10:32:08.918Z (about 2 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
- Maintainers (1)
openbsd-7.9-amd64: devel/ruby-rbtree,ruby34
sorted associative collection
- Homepage: https://github.com/mame/rbtree
- Licenses: mit
- Latest release: 0.4.6 (published 5 months ago)
- Last Synced: 2026-08-01T10:32:46.675Z (about 2 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
- Maintainers (1)
debian-13: ruby-rbtree
- Homepage: https://github.com/mame/rbtree
- Documentation: https://packages.debian.org/trixie/ruby-rbtree
- Licenses: mit
- Latest release: 0.4.6-1 (published 7 months ago)
- Last Synced: 2026-03-14T18:10:16.458Z (6 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
ubuntu-24.04: ruby-rbtree
- Homepage: https://github.com/mame/rbtree
- Licenses: mit
- Latest release: 0.4.6-1build2 (published 8 months ago)
- Last Synced: 2026-08-21T02:30:49.099Z (about 1 month ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
ubuntu-24.10: ruby-rbtree
- Homepage: https://github.com/mame/rbtree
- Licenses: mit
- Latest release: 0.4.6-1build3 (published 8 months ago)
- Last Synced: 2026-03-09T18:22:14.054Z (7 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
Dependencies
- actions/checkout v2 composite
- ruby/setup-ruby v1 composite
Score: 24.88078656185772