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

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

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.

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.



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

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

#attributesObject (readonly)

Returns the value of attribute attributes.



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

def attributes
  @attributes
end

Instance Method Details

#documentstring

The URI of the cell’s text document content.

Returns:

  • (string)


36
37
38
# File 'lib/language_server/protocol/interface/notebook_cell.rb', line 36

def document
  attributes.fetch(:document)
end

#execution_summaryExecutionSummary

Additional execution summary information if supported by the client.

Returns:



53
54
55
# File 'lib/language_server/protocol/interface/notebook_cell.rb', line 53

def execution_summary
  attributes.fetch(:executionSummary)
end

#kindany

The cell’s kind

Returns:

  • (any)


27
28
29
# File 'lib/language_server/protocol/interface/notebook_cell.rb', line 27

def kind
  attributes.fetch(:kind)
end

#metadataLSPObject

Additional metadata stored with the cell.

Returns:

  • (LSPObject)


44
45
46
# File 'lib/language_server/protocol/interface/notebook_cell.rb', line 44

def 
  attributes.fetch(:metadata)
end

#to_hashObject



59
60
61
# File 'lib/language_server/protocol/interface/notebook_cell.rb', line 59

def to_hash
  attributes
end

#to_json(*args) ⇒ Object



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

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