Method: Cod::Pipe#get
- Defined in:
- lib/cod/pipe.rb
#get(opts = {}) ⇒ Object
Using #get on a pipe instance will close the other pipe end. Subsequent #put will receive a Cod::InvalidOperation.
Example:
pipe.get # => obj
98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/cod/pipe.rb', line 98 def get(opts={}) raise Cod::WriteOnlyChannel unless can_read? pipe.close_w loop do ready = Cod.select(nil, self) return deserialize_one if ready end rescue EOFError fail "All pipe ends seem to be closed. Reading from this pipe will not "+ "return any data." end |