Class: LanguageServer::Protocol::Interface::NotebookDocument
- Inherits:
-
Object
- Object
- LanguageServer::Protocol::Interface::NotebookDocument
- Defined in:
- lib/language_server/protocol/interface/notebook_document.rb
Overview
A notebook document.
Instance Attribute Summary collapse
- #attributes ⇒ Object readonly
Instance Method Summary collapse
-
#cells ⇒ NotebookCell[]
The cells of a notebook.
-
#initialize(uri:, notebook_type:, version:, metadata: nil, cells:) ⇒ NotebookDocument
constructor
A new instance of NotebookDocument.
-
#metadata ⇒ LSPObject | nil
Additional metadata stored with the notebook document.
-
#notebook_type ⇒ string
The type of the notebook.
- #to_hash ⇒ Object
- #to_json(*args) ⇒ Object
-
#uri ⇒ URI
The notebook document’s uri.
-
#version ⇒ integer
The version number of this document (it will increase after each change, including undo/redo).
Constructor Details
#initialize(uri:, notebook_type:, version:, metadata: nil, cells:) ⇒ NotebookDocument
Returns a new instance of NotebookDocument.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/language_server/protocol/interface/notebook_document.rb', line 10 def initialize(uri:, notebook_type:, version:, metadata: nil, cells:) @attributes = {} @attributes[:uri] = uri @attributes[:notebookType] = notebook_type @attributes[:version] = version @attributes[:metadata] = if @attributes[:cells] = cells @attributes.freeze end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
66 67 68 |
# File 'lib/language_server/protocol/interface/notebook_document.rb', line 66 def attributes @attributes end |
Instance Method Details
#cells ⇒ NotebookCell[]
The cells of a notebook.
62 63 64 |
# File 'lib/language_server/protocol/interface/notebook_document.rb', line 62 def cells attributes.fetch(:cells) end |
#metadata ⇒ LSPObject | nil
Additional metadata stored with the notebook document.
Note: should always be an object literal (e.g. LSPObject)
54 55 56 |
# File 'lib/language_server/protocol/interface/notebook_document.rb', line 54 def attributes.fetch(:metadata) end |
#notebook_type ⇒ string
The type of the notebook.
34 35 36 |
# File 'lib/language_server/protocol/interface/notebook_document.rb', line 34 def notebook_type attributes.fetch(:notebookType) end |
#to_hash ⇒ Object
68 69 70 |
# File 'lib/language_server/protocol/interface/notebook_document.rb', line 68 def to_hash attributes end |
#to_json(*args) ⇒ Object
72 73 74 |
# File 'lib/language_server/protocol/interface/notebook_document.rb', line 72 def to_json(*args) to_hash.to_json(*args) end |
#uri ⇒ URI
The notebook document’s uri.
26 27 28 |
# File 'lib/language_server/protocol/interface/notebook_document.rb', line 26 def uri attributes.fetch(:uri) end |
#version ⇒ integer
The version number of this document (it will increase after each change, including undo/redo).
43 44 45 |
# File 'lib/language_server/protocol/interface/notebook_document.rb', line 43 def version attributes.fetch(:version) end |