Class: DRb::WeakIdConv::WeakSet (Ruby 2.7.2)
Description: Class : DRb::WeakIdConv::WeakSet - Ruby 2.7.2

### Home Classes Methods

### In Files

- drb/weakidconv.rb

### Parent

Object

### Methods

- ::new
- #add
- #fetch

### Included Modules

- MonitorMixin

### Class/Module Index

Quicksearch

- ACL
- ACL::ACLEntry
- ACL::ACLList
- DRb
- DRb::DRbArray
- DRb::DRbBadScheme
- DRb::DRbBadURI
- DRb::DRbConn
- DRb::DRbConnError
- DRb::DRbError
- DRb::DRbIdConv
- DRb::DRbIdConv
- DRb::DRbMessage
- DRb::DRbObject
- DRb::DRbObject
- DRb::DRbObservable
- DRb::DRbProtocol
- DRb::DRbRemoteError
- DRb::DRbSSLSocket
- DRb::DRbSSLSocket::SSLConfig
- DRb::DRbServerNotFound
- DRb::DRbTCPSocket
- DRb::DRbUNIXSocket
- DRb::DRbUndumped
- DRb::DRbUndumped
- DRb::DRbUnknown
- DRb::DRbUnknownError
- DRb::ExtServ
- DRb::ExtServManager
- DRb::GW
- DRb::GWIdConv
- DRb::Thread
- DRb::ThreadObject
- DRb::TimerIdConv
- DRb::TimerIdConv::TimerHolder2
- DRb::TimerIdConv::TimerHolder2::InvalidIndexError
- DRb::WeakIdConv
- DRb::WeakIdConv::WeakSet
- Object

No matching classes.

# DRb::WeakIdConv::WeakSet

### Public Class Methods

new() click to toggle source

                   # File drb/weakidconv.rb, line 14
    def initialize
      super()
      @immutable = {}
      @map = ObjectSpace::WeakMap.new
    end

### Public Instance Methods

add(obj) click to toggle source

                   # File drb/weakidconv.rb, line 20
    def add(obj)
      synchronize do
        begin
          @map[obj] = self
        rescue ArgumentError
          @immutable[obj.__id__] = obj
        end
        return obj.__id__
      end
    end

fetch(ref) click to toggle source

                   # File drb/weakidconv.rb, line 31
    def fetch(ref)
      synchronize do
        @immutable.fetch(ref) {
          @map.each { |key, _|
            return key if key.__id__ == ref
          }
          raise RangeError.new("invalid reference")
        }
      end
    end