Object
# File ruby-3.1.2/lib/drb/weakidconv.rb, line 14 def initialize super() @immutable = {} @map = ObjectSpace::WeakMap.new end
# File ruby-3.1.2/lib/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
# File ruby-3.1.2/lib/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
This page was generated for Ruby 3.1.2
Ruby-doc.org is provided by James Britt and Neurogami. Hack your world. Feed your head. Live curious.
Generated with Ruby-doc Rdoc Generator 0.42.0.