This method is deprecated or moved on the latest stable version.
The last existing version (v1_9_2_180) is shown here.
model2data(iter)
public
Convert the tree model starting from Gtk::TreeIter iter into a
Ruby data structure and return it.
# File ext/json/lib/json/editor.rb, line 83
def Editor.model2data(iter)
return nil if iter.nil?
case iter.type
when 'Hash'
hash = {}
iter.each { |c| hash[c.content] = Editor.model2data(c.first_child) }
hash
when 'Array'
array = Array.new(iter.n_children)
iter.each_with_index { |c, i| array[i] = Editor.model2data(c) }
array
when 'Key'
iter.content
when 'String'
iter.content
when 'Numeric'
content = iter.content
if /\./.match(content)
content.to_f
else
content.to_i
end
when 'TrueClass'
true
when 'FalseClass'
false
when 'NilClass'
nil
else
fail "Unknown type found in model: #{iter.type}"
end
end