Sha256: 25c0674b3be24589ab3590abdd6a042191cc5ab14e315bb0cc0067936759fe22

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

module LanguageServer
  module Protocol
    module Interface
      #
      # 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

2 entries across 2 versions & 1 rubygems

Version Path
language_server-protocol-0.4.0 lib/language_server/protocol/interface/registration.rb
language_server-protocol-0.3.0 lib/language_server/protocol/interface/registration.rb