Sha256: 893b88ea724998df0b9b9c357d6a007550b912704fd1952e62f812fa6fd87881

Contents?: true

Size: 1.54 KB

Versions: 1

Compression:

Stored size: 1.54 KB

Contents

# frozen_string_literal: true

require 'puppet_editor_services/server'
require 'puppet_editor_services/connection/base'
require 'puppet_editor_services/protocol/base'

module PuppetEditorServices
  module Server
    class Base
      attr_reader :server_options, :connection_options, :protocol_options, :handler_options

      def name
        'SRV'
      end

      def initialize(server_options, connection_options, protocol_options, handler_options)
        @server_options = server_options.nil? ? {} : server_options.dup
        @connection_options = connection_options.nil? ? {} : connection_options.dup
        @protocol_options = protocol_options.nil? ? {} : protocol_options.dup
        @handler_options = handler_options.nil? ? {} : handler_options.dup

        @connection_options[:class] = PuppetEditorServices::Connection::Base if @connection_options[:class].nil?
        @protocol_options[:class] = PuppetEditorServices::Protocol::Base if @protocol_options[:class].nil?
        @handler_options[:class] = PuppetEditorServices::Handler::Base if @handler_options[:class].nil?

        @server_options[:servicename] = 'LANGUAGE SERVER' if @server_options[:servicename].nil?

        # Assumes there's only ONE active simpler server running at a time.
        PuppetEditorServices::Server.current_server = self
      end

      # Returns a client connection for a given connection_id
      def connection(connection_id); end

      def start; end

      def log(message)
        PuppetEditorServices.log_message(:debug, "#{name}: #{message}")
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
puppet-editor-services-2.0.4 lib/puppet_editor_services/server/base.rb