Class: PuppetEditorServices::Connection::Tcp
- Defined in:
- lib/puppet_editor_services/connection/tcp.rb
Instance Attribute Summary collapse
-
#socket ⇒ Object
Returns the value of attribute socket.
Attributes inherited from Base
Instance Method Summary collapse
- #close ⇒ Object
- #close_after_writing ⇒ Object
-
#initialize(server, socket) ⇒ Tcp
constructor
A new instance of Tcp.
- #send_data(data) ⇒ Object
Methods inherited from Base
#error?, #id, #post_init, #receive_data, #unbind
Constructor Details
#initialize(server, socket) ⇒ Tcp
Returns a new instance of Tcp.
10 11 12 13 |
# File 'lib/puppet_editor_services/connection/tcp.rb', line 10 def initialize(server, socket) super(server) @socket = socket end |
Instance Attribute Details
#socket ⇒ Object
Returns the value of attribute socket.
8 9 10 |
# File 'lib/puppet_editor_services/connection/tcp.rb', line 8 def socket @socket end |
Instance Method Details
#close ⇒ Object
28 29 30 31 |
# File 'lib/puppet_editor_services/connection/tcp.rb', line 28 def close server.remove_connection_async(socket) true end |
#close_after_writing ⇒ Object
22 23 24 25 26 |
# File 'lib/puppet_editor_services/connection/tcp.rb', line 22 def close_after_writing socket.flush unless socket.nil? server.remove_connection_async(socket) true end |
#send_data(data) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/puppet_editor_services/connection/tcp.rb', line 15 def send_data(data) return false if socket.nil? socket.write(data) true end |