Sha256: c25f2811796d0c3663cca74fb1f1377cec382df7f7a8bd1c7d8b5028aab37174

Contents?: true

Size: 1.12 KB

Versions: 7

Compression:

Stored size: 1.12 KB

Contents

module LanguageServer
  module Protocol
    module Interfaces
      #
      # General paramters to to regsiter for a capability.
      #
      class Registration
        def initialize(id:, method:, register_options: nil)
          @attributes = {}

          @attributes[:id] = id
          @attributes[:method] = method
          @attributes[:registerOptions] = register_options if register_options

          @attributes.freeze
        end

        #
        # The id used to register the request. The id can be used to deregister
        # the request again.
        #
        # @return [string]
        def id
          attributes.fetch(:id)
        end

        #
        # The method / capability to register for.
        #
        # @return [string]
        def method
          attributes.fetch(:method)
        end

        #
        # Options necessary for the registration.
        #
        # @return [any]
        def register_options
          attributes.fetch(:registerOptions)
        end

        attr_reader :attributes

        def to_json(*args)
          attributes.to_json(*args)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
language_server-protocol-0.2.0 lib/language_server/protocol/interfaces/registration.rb
language_server-protocol-0.1.0 lib/language_server/protocol/interfaces/registration.rb
language_server-0.4.0 lib/language_server/protocol/interfaces/registration.rb
language_server-0.3.1 lib/language_server/protocol/interfaces/registration.rb
language_server-0.3.0 lib/language_server/protocol/interfaces/registration.rb
language_server-0.2.0 lib/language_server/protocol/interfaces/registration.rb
language_server-0.1.0 lib/language_server/protocol/interfaces/registration.rb