Class: UU::RemoteHelper
- Inherits:
-
Object
- Object
- UU::RemoteHelper
- Defined in:
- lib/drb/http0helper.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
Instance Method Summary collapse
- #disable ⇒ Object
- #enable ⇒ Object
- #eval_(code) ⇒ Object
-
#initialize ⇒ RemoteHelper
constructor
A new instance of RemoteHelper.
- #klass(name) ⇒ Object
- #reset ⇒ Object
Constructor Details
#initialize ⇒ RemoteHelper
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
#count ⇒ Object (readonly)
Returns the value of attribute count.
26 27 28 |
# File 'lib/drb/http0helper.rb', line 26 def count @count end |
Instance Method Details
#disable ⇒ Object
28 29 30 31 32 33 |
# File 'lib/drb/http0helper.rb', line 28 def disable @mutex.synchronize do @count += 1 GC.disable end end |
#enable ⇒ Object
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 |
#reset ⇒ Object
43 44 45 46 47 48 |
# File 'lib/drb/http0helper.rb', line 43 def reset @mutex.synchronize do @count = 0 GC.enable end end |