From: Nat P. <np...@us...> - 2002-08-27 20:42:48
|
Update of /cvsroot/mockobjects/no-stone-unturned/rubysrc In directory usw-pr-cvs1:/tmp/cvs-serv31339 Modified Files: addrservlet.rb tasks.txt Log Message: Refactoring: extract method AddressBookServlet::respond_no_match Index: addrservlet.rb =================================================================== RCS file: /cvsroot/mockobjects/no-stone-unturned/rubysrc/addrservlet.rb,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- addrservlet.rb 27 Aug 2002 20:38:41 -0000 1.3 +++ addrservlet.rb 27 Aug 2002 20:42:44 -0000 1.4 @@ -13,15 +13,18 @@ query = request.query_string if query == nil - response.body = 'no address found' + respond_no_match( response ) else - name = WEBrick::HTTPUtils::unescape_form( request.query_string ) - + name = WEBrick::HTTPUtils::unescape_form( query ) if @address_book.has_key?(name) response.body = @address_book[name] else - response.body = 'no address found' + respond_no_match( response ) end end + end + + def respond_no_match( response ) + response.body = "no address found" end end Index: tasks.txt =================================================================== RCS file: /cvsroot/mockobjects/no-stone-unturned/rubysrc/tasks.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- tasks.txt 27 Aug 2002 20:38:41 -0000 1.2 +++ tasks.txt 27 Aug 2002 20:42:44 -0000 1.3 @@ -20,5 +20,8 @@ - using blocks to handle expectations +REFACTORING + + 1c) Retrieve the entries from a file, specified as a servlet property. Values are held in memory. |