| Path: | lib/json/editor.rb |
| Last Update: | Sat Jan 30 07:34:15 +0000 2010 |
Edit the string json with encoding encoding in the editor.
# 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.
# 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