Sha256: c83e63d9df1d2a76c5d88e107abe3875ff4b418be94ffa9fdfed6341de53e4fd
Contents?: true
Size: 893 Bytes
Versions: 10
Compression:
Stored size: 893 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
10 entries across 10 versions & 1 rubygems