class Object
Public Instance Methods
help_win()
click to toggle source
_ HELP MENU _
# File lib/gui_ruby_editor.rb, line 73 def help_win begin $win.destroy rescue end $win = TkToplevel.new{title "Help Window"} TkLabel.new($win){ text "This Ruby Editor allows you to: 1. Open a saved script from folder through a dialogbox(Win1 Menu) 2. Type your own new script and Save it (Save & Saveas in Win1 Menu) 3. Clear Win1 screen for a new script (New or Close from Win1 Menu) 4. Output from execution of code appears in Win2 5. You can clear Win2 from Win2 Menu (clear) 6. You may save the output of the script in a separate file (SaveAs in Win2 Menu) The green button run the script and send output to Win2. If you click the green button before selection of a script, a fatal error may occur. " borderwidth 5 font TkFont.new('times 16 bold') background "yellow" relief "groove" justify "left" }.grid('row' => 0, 'column' => 0) TkButton.new($win) { text "OK" command "$win.destroy" }.grid('row' => 1, 'column' => 0) end
runcode()
click to toggle source
# File lib/gui_ruby_editor.rb, line 33 def runcode theCode = $win1.get("1.0", 'end') File.write("tmp.rb", theCode) $out = %x[ruby "tmp.rb" 2>&1] $win2.delete(1.0, 'end') $win2.insert('end', "#$out") end
runfile()
click to toggle source
# File lib/gui_ruby_editor.rb, line 14 def runfile if $filename != nil $out = %x[ruby "#$filename" 2>&1] $win2.delete(1.0, 'end') $win2.insert('end', "#$out") else $win2.insert('end', "No File Selected") end end