Class: LanguageServer::Protocol::Interface::ResourceOperation

Inherits:
Object
  • Object
show all
Defined in:
lib/language_server/protocol/interface/resource_operation.rb

Overview

A generic resource operation.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(kind:, annotation_id: nil) ⇒ ResourceOperation

Returns a new instance of ResourceOperation.



8
9
10
11
12
13
14
15
# File 'lib/language_server/protocol/interface/resource_operation.rb', line 8

def initialize(kind:, annotation_id: nil)
  @attributes = {}

  @attributes[:kind] = kind
  @attributes[:annotationId] = annotation_id if annotation_id

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



35
36
37
# File 'lib/language_server/protocol/interface/resource_operation.rb', line 35

def attributes
  @attributes
end

Instance Method Details

#annotation_idChangeAnnotationIdentifier | nil

An optional annotation identifier describing the operation.

Returns:

  • (ChangeAnnotationIdentifier | nil)

Since:

  • 3.16.0



31
32
33
# File 'lib/language_server/protocol/interface/resource_operation.rb', line 31

def annotation_id
  attributes.fetch(:annotationId)
end

#kindstring

The resource operation kind.

Returns:

  • (string)


21
22
23
# File 'lib/language_server/protocol/interface/resource_operation.rb', line 21

def kind
  attributes.fetch(:kind)
end

#to_hashObject



37
38
39
# File 'lib/language_server/protocol/interface/resource_operation.rb', line 37

def to_hash
  attributes
end

#to_json(*args) ⇒ Object



41
42
43
# File 'lib/language_server/protocol/interface/resource_operation.rb', line 41

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