Methods
- A
- D
- N
Class Public methods
new()
Link
Source: show
# File sample/drb/dchats.rb, line 31 def initialize @mutex = Mutex.new @members = {} end
Instance Public methods
add_member(there)
Link
Source: show
# File sample/drb/dchats.rb, line 36 def add_member(there) client = ChatEntry.new(self, there) @mutex.synchronize do @members[there] = client end client end
distribute(there, str)
Link
Source: show
# File sample/drb/dchats.rb, line 44 def distribute(there, str) name = @members[there].name msg = "<#{name}> #{str}" msg2 = ">#{name}< #{str}" @mutex.synchronize do for m in @members.keys begin if m == there @members[m].listen(msg2) else @members[m].listen(msg) end rescue p $! @members.delete(m) end end end end