Class: Hind::LSIF::Vertex
- Inherits:
-
Object
- Object
- Hind::LSIF::Vertex
- Defined in:
- lib/hind/lsif/vertex.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
Instance Method Summary collapse
-
#initialize(id, label, data = nil) ⇒ Vertex
constructor
A new instance of Vertex.
- #to_json(*_args) ⇒ Object
Constructor Details
#initialize(id, label, data = nil) ⇒ Vertex
Returns a new instance of Vertex.
8 9 10 11 12 |
# File 'lib/hind/lsif/vertex.rb', line 8 def initialize(id, label, data = nil) @id = id @label = label @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
6 7 8 |
# File 'lib/hind/lsif/vertex.rb', line 6 def data @data end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/hind/lsif/vertex.rb', line 6 def id @id end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
6 7 8 |
# File 'lib/hind/lsif/vertex.rb', line 6 def label @label end |
Instance Method Details
#to_json(*_args) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/hind/lsif/vertex.rb', line 14 def to_json(*_args) json = { id: @id, type: 'vertex', label: @label } if @data if %w[hoverResult definitionResult referenceResult].include?(@label) json[:result] = @data else json.merge!(@data) end end json end |