46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/ttk/loaders/Yaml.rb', line 46
def ttk_loader_yaml_transform
@type_id = nil unless defined? @type_id
t = nil
if @value.is_a? Hash
t = Hash.new
children_with_index.each do |v, k|
key_transform(t, k, v)
end
elsif @value.is_a? Array
if not @value.empty? and @value.all? { |x| x.is_a? Hash and x.size == 1 }
t = OHash.new
@value.each do |x|
k, v = x.to_a
key_transform(t, k, v)
end
else
t = Array.new
@value.each do |v|
t.push v.ttk_loader_yaml_transform
end
end
else
t = @value
end
YAML.transfer(@type_id, t)
end
|