Method deprecated or moved
This method is deprecated or moved on the latest stable version.
The last existing version (v1_9_2_180) is shown here.
append_new_node(item)
public
Append a new node to the selected Hash or Array.
Show source
def append_new_node(item)
if parent = selection.selected
parent_type = parent.type
case parent_type
when 'Hash'
key, type, content = ask_for_hash_pair(parent)
key or return
iter = create_node(parent, 'Key', key)
iter = create_node(iter, type, content)
toplevel.display_status(
"Added a (key, value)-pair to '#{parent_type}'.")
window.change
when 'Array'
type, content = ask_for_element(parent)
type or return
iter = create_node(parent, type, content)
window.change
toplevel.display_status("Appendend an element to '#{parent_type}'.")
else
toplevel.display_status("Cannot append to '#{parent_type}'!")
end
else
type, content = ask_for_element
type or return
iter = create_node(nil, type, content)
window.change
end
end