Method: JSON::Editor::PopUpMenu#cut_node

Defined in:
lib/json/editor.rb

#cut_node(item) ⇒ Object

Cut the selected node and its subtree, and save it into the clipboard.



287
288
289
290
291
292
293
294
295
296
297
298
299
300
# File 'lib/json/editor.rb', line 287

def cut_node(item)
  if current = selection.selected
    if current and current.type == 'Key'
      @clipboard_data = {
        current.content => Editor.model2data(current.first_child)
      }
    else
      @clipboard_data = Editor.model2data(current)
    end
    model.remove(current)
    window.change
    toplevel.display_status("Cut a node from tree.")
  end
end