Method: JSON::Editor::JSONTreeView#create_node
- Defined in:
- lib/gems/json_pure-1.1.3/lib/json/editor.rb
#create_node(parent, type, content) ⇒ Object
Create a type node with content content, and add it to parent in the model. If parent is nil, create a new model and put it into the editor treeview.
812 813 814 815 816 817 818 819 820 821 822 823 |
# File 'lib/gems/json_pure-1.1.3/lib/json/editor.rb', line 812 def create_node(parent, type, content) iter = if parent model.append(parent) else new_model = Editor.data2model(nil) toplevel.view_new_model(new_model) new_model.iter_first end iter.type, iter.content = type, content (parent) if parent iter end |