module Forkhandle
Attributes
handles[RW]
pid[RW]
tid[RW]
Public Instance Methods
clear!()
click to toggle source
# File lib/forkhandle.rb, line 52 def clear! each do |key, val| next if key.pid == pid begin val.close rescue nil end end end
description()
click to toggle source
# File lib/forkhandle.rb, line 6 def description "a teeny library / design pattern for managing connections in a process and thread safe fashion" end
get(key, &block)
click to toggle source
# File lib/forkhandle.rb, line 39 def get(key, &block) @handles.fetch(key_for(key)) do clear! block.call end end
Also aliased as: fetch
key_for(key)
click to toggle source
# File lib/forkhandle.rb, line 35 def key_for(key) Key.for(@pid, @tid, key) end
set(key, value)
click to toggle source
# File lib/forkhandle.rb, line 48 def set(key, value) @handles[key_for(key)] = value end
version()
click to toggle source
# File lib/forkhandle.rb, line 2 def version '0.0.3' end