editor.rb

Path: lib/json/editor.rb
Last Update: Mon Nov 26 22:32:41 +0100 2007

To use the GUI JSON editor, start the edit_json.rb executable script. It requires ruby-gtk to be installed.

Required files

gtk2   iconv   json   rbconfig   open-uri  

Methods

edit   start  

Public Class methods

Edit the string json with encoding encoding in the editor.

[Source]

# File lib/json/editor.rb, line 1353
      def edit(json, encoding = 'utf8')
        start(encoding) do |window|
          window.edit json
        end
      end

Starts a JSON Editor. If a block was given, it yields to the JSON::Editor::MainWindow instance.

[Source]

# File lib/json/editor.rb, line 1343
      def start(encoding = 'utf8') # :yield: window
        Gtk.init
        @window = Editor::MainWindow.new(encoding)
        @window.icon_list = [ Editor.fetch_icon('json') ]
        yield @window if block_given?
        @window.show_all
        Gtk.main
      end

[Validate]