Class: Pixelflut::Client::NonblockSocket
- Defined in:
- lib/pixelflut/client/socket.rb
Instance Attribute Summary collapse
-
#state ⇒ Object
readonly
Returns the value of attribute state.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(address, data) ⇒ NonblockSocket
constructor
A new instance of NonblockSocket.
Methods inherited from Socket
#connect?, #readline_with_timeout, #write_with_timout
Constructor Details
#initialize(address, data) ⇒ NonblockSocket
Returns a new instance of NonblockSocket.
53 54 55 56 57 58 |
# File 'lib/pixelflut/client/socket.rb', line 53 def initialize(address, data) super(address) @state = :not_connected @data = data @size = data.bytesize end |
Instance Attribute Details
#state ⇒ Object (readonly)
Returns the value of attribute state.
51 52 53 |
# File 'lib/pixelflut/client/socket.rb', line 51 def state @state end |
Instance Method Details
#call ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/pixelflut/client/socket.rb', line 60 def call case @state when :not_connected do_connect when :wait_connect do_wait_for_connect when :write do_write else close @state = :closed end end |