Sha256: 047ff80b37987c3678ce8871313646746352ecb1d04458787884538cbbf1b050
Contents?: true
Size: 825 Bytes
Versions: 7
Compression:
Stored size: 825 Bytes
Contents
# this method adds a new address record or saves changes def createnewnamerecord require 'fileutils' if @a_filename newname = "%s" % [@a_filename] # grab the new filename to create newdata =@a_name.to_s + "\n" + @a_address.to_s + "\n" + @a_citystatezip.to_s + "\n" + @a_phone.to_s + "\n" + @a_email.to_s + "\n" + @a_comment1.to_s + "\n" + @a_comment2.to_s + "\n" + @a_comment3.to_s + "\n" fullnewname = newname + ".nam" begin # exception trapped block fileName = File.join($addressfiles_directory, fullnewname ) fd = File.open(fileName,"w") fd.print(newdata) # save the record info to the file fd.close @createnewnamerecorddisplay=newdata # show the record info in the browser rescue SystemCallError, StandardError $stderr.print "system call error: " + $! end # exception rescue end end
Version data entries
7 entries across 7 versions & 2 rubygems