Class: DSP::Variable

Inherits:
DSPBase show all
Defined in:
lib/dsp/dsp_protocol.rb

Overview

interface Variable {

    /** The variable's name. */
    name: string;
    /** The variable's value. This can be a multi-line text, e.g. for a function the body of a function. */
    value: string;
    /** The type of the variable's value. Typically shown in the UI when hovering over the value.
        This attribute should only be returned by a debug adapter if the client has passed the value true for the 'supportsVariableType' capability of the 'initialize' request.
    */
    type?: string;
    /** Properties of a variable that can be used to determine how to render the variable in the UI. */
    presentationHint?: VariablePresentationHint;
    /** Optional evaluatable name of this variable which can be passed to the 'EvaluateRequest' to fetch the variable's value. */
    evaluateName?: string;
    /** If variablesReference is > 0, the variable is structured and its children can be retrieved by passing variablesReference to the VariablesRequest. */
    variablesReference: number;
    /** The number of named child variables.
        The client can use this optional information to present the children in a paged UI and fetch them in chunks.
    */
    namedVariables?: number;
    /** The number of indexed child variables.
        The client can use this optional information to present the children in a paged UI and fetch them in chunks.
    */
    indexedVariables?: number;
    /** Optional memory reference for the variable if the variable represents executable code, such as a function pointer.
        This attribute is only required if the client has passed the value true for the 'supportsMemoryReferences' capability of the 'initialize' request.
    */
    memoryReference?: string;
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from DSPBase

#to_h, #to_json

Constructor Details

#initialize(initial_hash = nil) ⇒ Variable

Returns a new instance of Variable.



4067
4068
4069
4070
# File 'lib/dsp/dsp_protocol.rb', line 4067

def initialize(initial_hash = nil)
  super
  @optional_method_names = %i[type presentationHint evaluateName namedVariables indexedVariables memoryReference]
end

Instance Attribute Details

#evaluateNameObject

type: string # type: string # type: string # type: VariablePresentationHint # type: string # type: number # type: number # type: number # type: string



4065
4066
4067
# File 'lib/dsp/dsp_protocol.rb', line 4065

def evaluateName
  @evaluateName
end

#indexedVariablesObject

type: string # type: string # type: string # type: VariablePresentationHint # type: string # type: number # type: number # type: number # type: string



4065
4066
4067
# File 'lib/dsp/dsp_protocol.rb', line 4065

def indexedVariables
  @indexedVariables
end

#memoryReferenceObject

type: string # type: string # type: string # type: VariablePresentationHint # type: string # type: number # type: number # type: number # type: string



4065
4066
4067
# File 'lib/dsp/dsp_protocol.rb', line 4065

def memoryReference
  @memoryReference
end

#nameObject

type: string # type: string # type: string # type: VariablePresentationHint # type: string # type: number # type: number # type: number # type: string



4065
4066
4067
# File 'lib/dsp/dsp_protocol.rb', line 4065

def name
  @name
end

#namedVariablesObject

type: string # type: string # type: string # type: VariablePresentationHint # type: string # type: number # type: number # type: number # type: string



4065
4066
4067
# File 'lib/dsp/dsp_protocol.rb', line 4065

def namedVariables
  @namedVariables
end

#presentationHintObject

type: string # type: string # type: string # type: VariablePresentationHint # type: string # type: number # type: number # type: number # type: string



4065
4066
4067
# File 'lib/dsp/dsp_protocol.rb', line 4065

def presentationHint
  @presentationHint
end

#typeObject

type: string # type: string # type: string # type: VariablePresentationHint # type: string # type: number # type: number # type: number # type: string



4065
4066
4067
# File 'lib/dsp/dsp_protocol.rb', line 4065

def type
  @type
end

#valueObject

type: string # type: string # type: string # type: VariablePresentationHint # type: string # type: number # type: number # type: number # type: string



4065
4066
4067
# File 'lib/dsp/dsp_protocol.rb', line 4065

def value
  @value
end

#variablesReferenceObject

type: string # type: string # type: string # type: VariablePresentationHint # type: string # type: number # type: number # type: number # type: string



4065
4066
4067
# File 'lib/dsp/dsp_protocol.rb', line 4065

def variablesReference
  @variablesReference
end

Instance Method Details

#from_h!(value) ⇒ Object



4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
# File 'lib/dsp/dsp_protocol.rb', line 4072

def from_h!(value)
  value = {} if value.nil?
  self.name = value['name']
  self.value = value['value']
  self.type = value['type']
  self.presentationHint = VariablePresentationHint.new(value['presentationHint']) unless value['presentationHint'].nil?
  self.evaluateName = value['evaluateName']
  self.variablesReference = value['variablesReference']
  self.namedVariables = value['namedVariables']
  self.indexedVariables = value['indexedVariables']
  self.memoryReference = value['memoryReference']
  self
end