Class: LanguageServer::Protocol::Interface::NotebookDocumentFilter

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

Overview

A notebook document filter denotes a notebook document by different properties. The properties will be match against the notebook’s URI (same as with documents)

Since:

  • 3.17.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(notebook_type:, scheme: nil, pattern: nil) ⇒ NotebookDocumentFilter

Returns a new instance of NotebookDocumentFilter.

Since:

  • 3.17.0



12
13
14
15
16
17
18
19
20
# File 'lib/language_server/protocol/interface/notebook_document_filter.rb', line 12

def initialize(notebook_type:, scheme: nil, pattern: nil)
  @attributes = {}

  @attributes[:notebookType] = notebook_type
  @attributes[:scheme] = scheme if scheme
  @attributes[:pattern] = pattern if pattern

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Since:

  • 3.17.0



46
47
48
# File 'lib/language_server/protocol/interface/notebook_document_filter.rb', line 46

def attributes
  @attributes
end

Instance Method Details

#notebook_typestring

The type of the enclosing notebook. */

Returns:

  • (string)

Since:

  • 3.17.0



26
27
28
# File 'lib/language_server/protocol/interface/notebook_document_filter.rb', line 26

def notebook_type
  attributes.fetch(:notebookType)
end

#patternstring | nil

A glob pattern. */

Returns:

  • (string | nil)

Since:

  • 3.17.0



42
43
44
# File 'lib/language_server/protocol/interface/notebook_document_filter.rb', line 42

def pattern
  attributes.fetch(:pattern)
end

#schemestring | nil

A Uri [scheme](#Uri.scheme), like file or untitled. */

Returns:

  • (string | nil)

Since:

  • 3.17.0



34
35
36
# File 'lib/language_server/protocol/interface/notebook_document_filter.rb', line 34

def scheme
  attributes.fetch(:scheme)
end

#to_hashObject

Since:

  • 3.17.0



48
49
50
# File 'lib/language_server/protocol/interface/notebook_document_filter.rb', line 48

def to_hash
  attributes
end

#to_json(*args) ⇒ Object

Since:

  • 3.17.0



52
53
54
# File 'lib/language_server/protocol/interface/notebook_document_filter.rb', line 52

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