Class: LanguageServer::Protocol::Interface::NotebookCell

Inherits:
Object
  • Object
show all
Defined in:
lib/language_server/protocol/interface/notebook_cell.rb,
sig/language_server/protocol/interface/notebook_cell.rbs

Overview

A notebook cell.

A cell's document URI must be unique across ALL notebook cells and can therefore be used to uniquely identify a notebook cell or the cell's text document.

Since:

  • 3.17.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(kind:, document:, metadata: nil, execution_summary: nil) ⇒ NotebookCell

Returns a new instance of NotebookCell.

Parameters:

  • kind: (Object)
  • document: (String)
  • metadata: (Object) (defaults to: nil)
  • execution_summary: (Object) (defaults to: nil)

Since:

  • 3.17.0



14
15
16
17
18
19
20
21
22
23
# File 'lib/language_server/protocol/interface/notebook_cell.rb', line 14

def initialize(kind:, document:, metadata: nil, execution_summary: nil)
  @attributes = {}

  @attributes[:kind] = kind
  @attributes[:document] = document
  @attributes[:metadata] =  if 
  @attributes[:executionSummary] = execution_summary if execution_summary

  @attributes.freeze
end

Instance Attribute Details

#attributesHash[Symbol, untyped] (readonly)

Returns:

  • (Hash[Symbol, untyped])

Since:

  • 3.17.0



61
62
63
# File 'lib/language_server/protocol/interface/notebook_cell.rb', line 61

def attributes
  @attributes
end

Instance Method Details

#documentDocumentUri

The URI of the cell's text document content.

Returns:

  • (DocumentUri)

Since:

  • 3.17.0



38
39
40
# File 'lib/language_server/protocol/interface/notebook_cell.rb', line 38

def document
  attributes.fetch(:document)
end

#execution_summaryExecutionSummary

Additional execution summary information if supported by the client.

Returns:

Since:

  • 3.17.0



57
58
59
# File 'lib/language_server/protocol/interface/notebook_cell.rb', line 57

def execution_summary
  attributes.fetch(:executionSummary)
end

#kindNotebookCellKind

The cell's kind

Returns:

  • (NotebookCellKind)

Since:

  • 3.17.0



29
30
31
# File 'lib/language_server/protocol/interface/notebook_cell.rb', line 29

def kind
  attributes.fetch(:kind)
end

#metadataLSPObject

Additional metadata stored with the cell.

Note: should always be an object literal (e.g. LSPObject)

Returns:

  • (LSPObject)

Since:

  • 3.17.0



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

def 
  attributes.fetch(:metadata)
end

#to_hashHash[Symbol, untyped]

Returns:

  • (Hash[Symbol, untyped])

Since:

  • 3.17.0



63
64
65
# File 'lib/language_server/protocol/interface/notebook_cell.rb', line 63

def to_hash
  attributes
end

#to_json(*args) ⇒ String

Parameters:

  • (Object)

Returns:

  • (String)

Since:

  • 3.17.0



67
68
69
# File 'lib/language_server/protocol/interface/notebook_cell.rb', line 67

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