Class: Readapt::Variable

Inherits:
Object
  • Object
show all
Defined in:
lib/readapt/variable.rb

Overview

Data retrieved from variable reference in the debugger.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, object) ⇒ Variable

Returns a new instance of Variable.

Parameters:

  • name (String, Symbol)
  • object (Object)


12
13
14
15
# File 'lib/readapt/variable.rb', line 12

def initialize name, object
  @name = name
  @object = object
end

Instance Attribute Details

#nameString (readonly)

Returns:

  • (String)


8
9
10
# File 'lib/readapt/variable.rb', line 8

def name
  @name
end

Instance Method Details

#referenceInteger

Returns:

  • (Integer)


18
19
20
# File 'lib/readapt/variable.rb', line 18

def reference
  @reference ||= unstructured || References.identify(object)
end

#typeString

Returns:

  • (String)


34
35
36
# File 'lib/readapt/variable.rb', line 34

def type
  object.class.to_s
end

#valueString

Returns:

  • (String)


23
24
25
26
27
28
29
30
31
# File 'lib/readapt/variable.rb', line 23

def value
  @value ||= if object.nil?
    'nil'
  elsif show_class_for_value?
    "#{empty? ? 'Empty ' : ''}#{object.class}"
  else
    object.to_s
  end
end