Sha256: 532ae9c593f9fb9b41cd339e1a77167b633f60ea8aeb9f02c913e5858e8da9b3

Contents?: true

Size: 817 Bytes

Versions: 4

Compression:

Stored size: 817 Bytes

Contents

module LanguageServer
  module Protocol
    module Interface
      class NotificationMessage < Message
        def initialize(jsonrpc:, method:, params: nil)
          @attributes = {}

          @attributes[:method] = method
          @attributes[:params] = params if params

          @attributes.freeze
        end

        #
        # The method to be invoked.
        #
        # @return [string]
        def method
          attributes.fetch(:method)
        end

        #
        # The notification's params.
        #
        # @return [object | any[]]
        def params
          attributes.fetch(:params)
        end

        attr_reader :attributes

        def to_hash
          attributes
        end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
language_server-protocol-3.14.0.1 lib/language_server/protocol/interface/notification_message.rb
language_server-protocol-3.14.0.0 lib/language_server/protocol/interface/notification_message.rb
language_server-protocol-3.12.0.0 lib/language_server/protocol/interface/notification_message.rb
language_server-protocol-3.7.0.0 lib/language_server/protocol/interface/notification_message.rb