Class: PuppetEditorServices::Protocol::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet_editor_services/protocol/base.rb

Direct Known Subclasses

DebugAdapter, JsonRPC

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ Base

Returns a new instance of Base.



8
9
10
11
# File 'lib/puppet_editor_services/protocol/base.rb', line 8

def initialize(connection)
  @connection = connection
  @handler = connection.server.handler_options[:class].new(self)
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



6
7
8
# File 'lib/puppet_editor_services/protocol/base.rb', line 6

def connection
  @connection
end

#handlerObject (readonly)

Returns the value of attribute handler.



6
7
8
# File 'lib/puppet_editor_services/protocol/base.rb', line 6

def handler
  @handler
end

Instance Method Details

#close_connectionObject



16
17
18
# File 'lib/puppet_editor_services/protocol/base.rb', line 16

def close_connection
  connection.close unless connection.nil?
end

#connection_error?Boolean

Returns:

  • (Boolean)


20
21
22
23
24
# File 'lib/puppet_editor_services/protocol/base.rb', line 20

def connection_error?
  return false if connection.nil?

  connection.error?
end

#receive_data(data) ⇒ Object

This method is abstract.


14
# File 'lib/puppet_editor_services/protocol/base.rb', line 14

def receive_data(data); end