Method: Printers::Xml::Variable#value

Defined in:
lib/debugger/printers/xml.rb

#valueObject



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/debugger/printers/xml.rb', line 112

def value
  if @value.is_a?(Array) || @value.is_a?(Hash)
    if has_children?
      "#{@value.class} (#{@value.size} element(s))"
    else
      "Empty #{@value.class}"
    end
  else
    value_str = @value.nil? ? 'nil' : @value.to_s
    if !value_str.is_a?(String)
      "ERROR: #{@value.class}.to_s method returns #{value_str.class}. Should return String."
    elsif binary_data?(value_str)
      "[Binary Data]"
    else
      value_str.gsub(/^(")(.*)(")$/, '\2')
    end
  end
rescue => e
  "<raised exception: #{e}>"
end