editor.rb

Path: lib/json/editor.rb
Last Update: Sat Jan 30 07:34:15 +0000 2010
OptionsMenu EditMenu PopUpMenu FileMenu MainWindow JSONTreeView Enumerable TreeIter JSONError GeneratorError ParserError MissingUnicodeSupport CircularDatastructure NestingError StandardError StringScanner Parser State Gtk::Window Gtk::TreeView MenuExtension Editor lib/json/editor.rb Gtk lib/json/common.rb Ext Editor lib/json/pure/parser.rb lib/json/pure/generator.rb Object Integer FalseClass Array Hash Float NilClass TrueClass Extend String GeneratorMethods Generator Pure JSON dot/f_1.png

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
1353:       def edit(json, encoding = 'utf8')
1354:         start(encoding) do |window|
1355:           window.edit json
1356:         end
1357:       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
1343:       def start(encoding = 'utf8') # :yield: window
1344:         Gtk.init
1345:         @window = Editor::MainWindow.new(encoding)
1346:         @window.icon_list = [ Editor.fetch_icon('json') ]
1347:         yield @window if block_given?
1348:         @window.show_all
1349:         Gtk.main
1350:       end

[Validate]