Sha256: 834f58e26c6ee53158ba05e32a863a3b42b58816695440bbb51ef7d9923ed8b6

Contents?: true

Size: 1.18 KB

Versions: 6

Compression:

Stored size: 1.18 KB

Contents

module LanguageServer
  module Protocol
    module Interface
      #
      # Rename file operation
      #
      class RenameFile
        def initialize(kind:, old_uri:, new_uri:, options: nil)
          @attributes = {}

          @attributes[:kind] = kind
          @attributes[:oldUri] = old_uri
          @attributes[:newUri] = new_uri
          @attributes[:options] = options if options

          @attributes.freeze
        end

        #
        # A rename
        #
        # @return ["rename"]
        def kind
          attributes.fetch(:kind)
        end

        #
        # The old (existing) location.
        #
        # @return [string]
        def old_uri
          attributes.fetch(:oldUri)
        end

        #
        # The new location.
        #
        # @return [string]
        def new_uri
          attributes.fetch(:newUri)
        end

        #
        # Rename options.
        #
        # @return [RenameFileOptions]
        def options
          attributes.fetch(:options)
        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

6 entries across 6 versions & 1 rubygems

Version Path
language_server-protocol-3.15.0.2 lib/language_server/protocol/interface/rename_file.rb
language_server-protocol-3.15.0.1 lib/language_server/protocol/interface/rename_file.rb
language_server-protocol-3.15.0.0 lib/language_server/protocol/interface/rename_file.rb
language_server-protocol-3.14.0.2 lib/language_server/protocol/interface/rename_file.rb
language_server-protocol-3.14.0.1 lib/language_server/protocol/interface/rename_file.rb
language_server-protocol-3.14.0.0 lib/language_server/protocol/interface/rename_file.rb