Module: YAML::BaseNode

Defined in:
lib/core_ex/yaml.rb

Instance Method Summary collapse

Instance Method Details

#symbol_safe_transformObject



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/core_ex/yaml.rb', line 64

def symbol_safe_transform
  @type_id = nil unless defined? @type_id
  t = nil
  case @value
  when Hash
    t = {}
    @value.each do |k, v|
      symbol_safe_key_transform(t, k, v)
    end
  when Array
    t = []
    @value.each do |v|
      t.push v.symbol_safe_transform
    end
  when /^:"(.*)"/, /^:(.*)/
    return $1.to_sym
  else
    return transform
  end
  YAML.transfer(@type_id, t)
end