Sha256: e281b7493b36ffbd4c815ba85f9b997be47a3888faf04ecb40ab4c24f06af4d5

Contents?: true

Size: 1.04 KB

Versions: 13

Compression:

Stored size: 1.04 KB

Contents

module LanguageServer
  module Protocol
    module Interface
      class Command
        def initialize(title:, command:, arguments: nil)
          @attributes = {}

          @attributes[:title] = title
          @attributes[:command] = command
          @attributes[:arguments] = arguments if arguments

          @attributes.freeze
        end

        #
        # Title of the command, like `save`.
        #
        # @return [string]
        def title
          attributes.fetch(:title)
        end

        #
        # The identifier of the actual command handler.
        #
        # @return [string]
        def command
          attributes.fetch(:command)
        end

        #
        # Arguments that the command handler should be
        # invoked with.
        #
        # @return [any[]]
        def arguments
          attributes.fetch(:arguments)
        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

13 entries across 13 versions & 1 rubygems

Version Path
language_server-protocol-3.16.0.3 lib/language_server/protocol/interface/command.rb
language_server-protocol-3.16.0.2 lib/language_server/protocol/interface/command.rb
language_server-protocol-3.16.0.1 lib/language_server/protocol/interface/command.rb
language_server-protocol-3.16.0.0 lib/language_server/protocol/interface/command.rb
language_server-protocol-3.15.0.2 lib/language_server/protocol/interface/command.rb
language_server-protocol-3.15.0.1 lib/language_server/protocol/interface/command.rb
language_server-protocol-3.15.0.0 lib/language_server/protocol/interface/command.rb
language_server-protocol-3.14.0.2 lib/language_server/protocol/interface/command.rb
language_server-protocol-3.14.0.1 lib/language_server/protocol/interface/command.rb
language_server-protocol-3.14.0.0 lib/language_server/protocol/interface/command.rb
language_server-protocol-3.12.0.0 lib/language_server/protocol/interface/command.rb
language_server-protocol-3.7.0.0 lib/language_server/protocol/interface/command.rb
language_server-protocol-0.5.0 lib/language_server/protocol/interface/command.rb