data2model (Editor)

         # File lib/json/editor.rb, line 121
    121:     def Editor.data2model(data, model = nil, parent = nil)
    122:       model ||= TreeStore.new(Gdk::Pixbuf, String, String)
    123:       iter = if block_given?
    124:         yield model
    125:       else
    126:         model.append(parent)
    127:       end
    128:       case data
    129:       when Hash
    130:         iter.type = 'Hash'
    131:         data.sort.each do |key, value|
    132:           pair_iter = model.append(iter)
    133:           pair_iter.type    = 'Key'
    134:           pair_iter.content = key.to_s
    135:           Editor.data2model(value, model, pair_iter)
    136:         end
    137:       when Array
    138:         iter.type = 'Array'
    139:         data.each do |value|
    140:           Editor.data2model(value, model, iter)
    141:         end
    142:       when Numeric
    143:         iter.type = 'Numeric'
    144:         iter.content = data.to_s
    145:       when String, true, false, nil
    146:         iter.type    = data.class.name
    147:         iter.content = data.nil? ? 'null' : data.to_s
    148:       else
    149:         iter.type    = 'String'
    150:         iter.content = data.to_s
    151:       end
    152:       model
    153:     end