Class: Rinda::TupleSpaceProxy::Port
- Inherits:
-
Object
- Object
- Rinda::TupleSpaceProxy::Port
- Defined in:
- lib/rinda/rinda.rb
Overview
A Port ensures that a moved tuple arrives properly at its destination and does not get lost.
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
:nodoc:.
Class Method Summary collapse
Instance Method Summary collapse
-
#close ⇒ Object
Don’t let the DRb thread push to it when remote sends tuple.
-
#initialize ⇒ Port
constructor
A new instance of Port.
-
#push(value) ⇒ Object
Stores
value
and ensure it does not get marshaled multiple times.
Constructor Details
#initialize ⇒ Port
Returns a new instance of Port.
230 231 232 233 |
# File 'lib/rinda/rinda.rb', line 230 def initialize @open = true @value = nil end |
Instance Attribute Details
#value ⇒ Object (readonly)
:nodoc:
216 217 218 |
# File 'lib/rinda/rinda.rb', line 216 def value @value end |
Class Method Details
.deliver ⇒ Object
218 219 220 221 222 223 224 225 226 227 228 |
# File 'lib/rinda/rinda.rb', line 218 def self.deliver port = new begin yield(port) ensure port.close end port.value end |
Instance Method Details
#close ⇒ Object
Don’t let the DRb thread push to it when remote sends tuple
238 239 240 |
# File 'lib/rinda/rinda.rb', line 238 def close @open = false end |
#push(value) ⇒ Object
Stores value
and ensure it does not get marshaled multiple times.
245 246 247 248 249 250 251 |
# File 'lib/rinda/rinda.rb', line 245 def push value raise 'port closed' unless @open @value = value nil # avoid Marshal end |