Class: UU::RemoteHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/drb/http0helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRemoteHelper

Returns a new instance of RemoteHelper.



21
22
23
24
# File 'lib/drb/http0helper.rb', line 21

def initialize
  @mutex = Mutex.new
  @count = 0
end

Instance Attribute Details

#countObject (readonly)

Returns the value of attribute count.



26
27
28
# File 'lib/drb/http0helper.rb', line 26

def count
  @count
end

Instance Method Details

#disableObject



28
29
30
31
32
33
# File 'lib/drb/http0helper.rb', line 28

def disable
  @mutex.synchronize do
    @count += 1
    GC.disable
  end
end

#enableObject



35
36
37
38
39
40
41
# File 'lib/drb/http0helper.rb', line 35

def enable
  @mutex.synchronize do
    @count -= 1
    break unless @count <= 0
    GC.enable
  end
end

#eval_(code) ⇒ Object



50
51
52
# File 'lib/drb/http0helper.rb', line 50

def eval_(code)
  instance_eval(code)
end

#klass(name) ⇒ Object



54
55
56
# File 'lib/drb/http0helper.rb', line 54

def klass(name)
  eval_(name.to_s)
end

#resetObject



43
44
45
46
47
48
# File 'lib/drb/http0helper.rb', line 43

def reset
  @mutex.synchronize do
    @count = 0
    GC.enable
  end
end