A summary of data about the Ruby ecosystem.

https://github.com/ruby-concurrency/ref

A weak reference implementation for Ruby that works across runtimes (MRI, REE, Jruby, Rubinius, and IronRuby)
https://github.com/ruby-concurrency/ref

Keywords from Contributors

background-jobs jobs sidekiq activejob activerecord mvc authorization grape oauth2 feature-flag

Last synced: about 16 hours ago
JSON representation

Repository metadata

A weak reference implementation for Ruby that works across runtimes (MRI, REE, Jruby, Rubinius, and IronRuby)

README.md

Ref

Gem Version Build Status Coverage Status Code Climate Dependency Status License Gitter chat

This library provides object references for Ruby as well as some common utilities for working with references. Object references are used to point to other objects and come in three distinct flavors that interact differently with the garbage collector.

  • Ref::StrongReference - This is a plain old pointer to another object.
  • Ref::WeakReference - This is a pointer to another object, but it is not seen by the garbage collector and the memory used by the object can be reclaimed at any time.
  • Ref::SoftReference - This is similar to a weak reference, but the garbage collector is not as eager to reclaim the referenced object.

All of these classes extend from a common Ref::Reference class and have a common interface.

Weak and soft references are useful when you have instantiated objects that you may want to use again but can recreate if necessary. Since the garbage collector determines when to reclaim the memory used by the objects, you don't need to worry about bloating the Ruby heap.

Example Usage

ref = Ref::WeakReference.new("hello")
ref.object # should be "hello"
ObjectSpace.garbage_collect
ref.object # should be nil (assuming the garbage collector reclaimed the reference)

Goodies

This library also includes tools for some common uses of weak and soft references.

  • Ref::WeakKeyMap - A map of keys to values where the keys are weak references
  • Ref::WeakValueMap - A map of keys to values where the values are weak references
  • Ref::SoftKeyMap - A map of keys to values where the keys are soft references
  • Ref::SoftValueMap - A map of keys to values where the values are soft references
  • Ref::ReferenceQueue - A thread safe implementation of a queue that will add references to itself as their objects are garbage collected.

Problems with WeakRef

Ruby does come with the WeakRef class in the standard library. However, there are issues with this class across several different Ruby runtimes. This gem provides a common interface to weak references that works across MRI, Ruby Enterprise Edition, YARV, JRuby and Rubinius.

  1. Rubinius - Rubinius implements WeakRef with a lighter weight version of delegation and works very well.
  2. YARV 1.9 - WeakRef is unsafe to use because the garbage collector can run in a different system thread than a thread allocating memory. This exposes a bug where a WeakRef may end up pointing to a completely different object than it originally referenced.
  3. MRI Ruby 2.0+ has a good implementation of WeakRef.

Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 4 days ago

Total Commits: 65
Total Committers: 7
Avg Commits per committer: 9.286
Development Distribution Score (DDS): 0.554

Commits in past year: 0
Committers in past year: 0
Avg Commits per committer in past year: 0.0
Development Distribution Score (DDS) in past year: 0.0

Name Email Commits
Brian Durand b****n@e****m 29
Olle Jonsson o****n@g****m 13
Lucas Allan Amorim l****n@g****m 11
Jerry D'Antonio s****r@g****m 6
Ian Unruh i****h@g****m 3
Kim Burgestrand k****m@b****e 2
Pedro Andrade p****e@g****m 1

Committer domains:


Issue and Pull Request metadata

Last synced: 3 months ago

Total issues: 19
Total pull requests: 18
Average time to close issues: 7 months
Average time to close pull requests: about 1 month
Total issue authors: 13
Total pull request authors: 8
Average comments per issue: 2.63
Average comments per pull request: 3.0
Merged pull request: 15
Bot issues: 0
Bot pull requests: 0

Past year issues: 0
Past year pull requests: 0
Past year average time to close issues: N/A
Past year average time to close pull requests: N/A
Past year issue authors: 0
Past year pull request authors: 0
Past year average comments per issue: 0
Past year average comments per pull request: 0
Past year merged pull request: 0
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/ruby-concurrency/ref

Top Issue Authors

  • jdantonio (7)
  • danielwaterworth (1)
  • gingerlime (1)
  • arkadiyt (1)
  • giladbu (1)
  • ghost (1)
  • CarmelK (1)
  • voxik (1)
  • strzibny (1)
  • lucasallan (1)
  • PikachuEXE (1)
  • the8472 (1)
  • jemc (1)

Top Pull Request Authors

  • lucasallan (9)
  • jdantonio (3)
  • pedroandrade (1)
  • schmurfy (1)
  • olleolleolle (1)
  • Burgestrand (1)
  • ianunruh (1)
  • kmcclellan (1)

Top Issue Labels

Top Pull Request Labels


Package metadata

gem.coop: ref

Library that implements weak, soft, and strong references in Ruby that work across multiple runtimes (MRI,Jruby and Rubinius). Also includes implementation of maps/hashes that use references and a reference queue.

  • Homepage: http://github.com/ruby-concurrency/ref
  • Documentation: http://www.rubydoc.info/gems/ref/
  • Licenses: MIT
  • Latest release: 2.0.0 (published over 10 years ago)
  • Last Synced: 2025-12-08T12:30:25.369Z (2 days ago)
  • Versions: 6
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 55,013,256 Total
  • Docker Downloads: 33,203,602
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 0.282%
    • Downloads: 0.467%
    • Docker downloads count: 0.662%
  • Maintainers (4)
rubygems.org: ref

Library that implements weak, soft, and strong references in Ruby that work across multiple runtimes (MRI,Jruby and Rubinius). Also includes implementation of maps/hashes that use references and a reference queue.

  • Homepage: http://github.com/ruby-concurrency/ref
  • Documentation: http://www.rubydoc.info/gems/ref/
  • Licenses: MIT
  • Latest release: 2.0.0 (published over 10 years ago)
  • Last Synced: 2025-12-06T23:01:55.425Z (4 days ago)
  • Versions: 6
  • Dependent Packages: 19
  • Dependent Repositories: 56,640
  • Downloads: 55,010,809 Total
  • Docker Downloads: 33,203,602
  • Rankings:
    • Dependent repos count: 0.146%
    • Downloads: 0.381%
    • Docker downloads count: 0.783%
    • Dependent packages count: 1.094%
    • Average: 3.056%
    • Stargazers count: 6.765%
    • Forks count: 9.168%
  • Maintainers (4)
proxy.golang.org: github.com/ruby-concurrency/ref

  • Homepage:
  • Documentation: https://pkg.go.dev/github.com/ruby-concurrency/ref#section-documentation
  • Licenses: mit
  • Latest release: v2.0.0+incompatible (published over 10 years ago)
  • Last Synced: 2025-12-06T23:01:57.394Z (4 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Stargazers count: 5.252%
    • Forks count: 6.637%
    • Average: 8.067%
    • Dependent packages count: 9.576%
    • Dependent repos count: 10.802%

Dependencies

Gemfile rubygems
  • coveralls ~> 0.8.21 development
  • inch ~> 0.4.6 development
  • rake ~> 10.3.2 development
  • rake-compiler = 0.9.5 development
  • redcarpet ~> 3.1.2 development
  • rspec ~> 3.6 development
  • test-unit ~> 3.0.9 development
  • yard ~> 0.8.7.4 development

Score: 25.109063706690662