Method: JSON::Editor::EditMenu#paste

Defined in:
lib/vendor/json_pure/lib/json/editor.rb

#paste(item) ⇒ Object

Copy json text from primary clipboard into model.



556
557
558
559
560
561
562
563
564
565
566
# File 'lib/vendor/json_pure/lib/json/editor.rb', line 556

def paste(item)
  c = Gtk::Clipboard.get(Gdk::Selection::PRIMARY)
  if json = c.wait_for_text
    window.ask_save if @changed
    begin
      window.edit json
    rescue JSON::ParserError
      window.clear
    end
  end
end