rahul8590 71 Posting Whiz

i was going through many ruby books and found this amazing text editing code (its just 17 lines ) provided u use Shoes toolkit.

The code is working fine with no errors . but its only able to read (open) and input file but not save the text u wrote in the text box into a file.

Shoes.app(:width => 600, :height => 500) do
stack do
flow do
@open_button = button "Open"
@save_button = button "Save"
end
@t = edit_box :width => 0.9, :height => 400
end
@open_button.click do
@t.text = File.read(ask_open_file)
end
@save_button.click do
File.new(ask_save_file, 'w') do |f|
f.puts @t.text
end
end
end

ne idea on wats going wrong ....?