Changeset 233
- Timestamp:
- 06/13/05 06:47:51 (3 years ago)
- Files:
-
- 1 modified
-
trunk/utils.rb (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/utils.rb
r163 r233 3 3 # $Id: utils.rb,v 1.20 2003/11/23 04:37:57 stillflame Exp $ 4 4 # 5 # Copyright (c) 2001-200 4, The FaerieMUD Consortium.5 # Copyright (c) 2001-2005, The FaerieMUD Consortium. 6 6 # 7 7 # This is free software. You may use, modify, and/or redistribute this … … 27 27 $yaml = true 28 28 rescue LoadError => e 29 $stderr.puts "No YAML; try() will use .inspect instead."29 $stderr.puts "No YAML; try() will use PrettyPrint instead." 30 30 $yaml = false 31 31 end … … 34 34 require 'rbconfig' 35 35 include Config 36 require 'pp' 36 37 37 38 module UtilityFunctions … … 170 171 ### specified <tt>msg</tt> instead. 171 172 def replaceMessage( msg ) 172 print ErasePreviousLine173 $stderr.print ErasePreviousLine 173 174 message( msg ) 174 175 end … … 176 177 ### Output a divider made up of <tt>length</tt> hyphen characters. 177 178 def divider( length=75 ) 178 puts "\r" + ("-" * length )179 $stderr.puts "\r" + ("-" * length ) 179 180 end 180 181 alias :writeLine :divider … … 483 484 def try( msg, bind=nil ) 484 485 result = nil 485 message "Trying #{msg}... "486 message "Trying #{msg}...\n" 486 487 487 488 begin … … 497 498 result = rval.to_yaml 498 499 else 499 result = rval.inspect 500 result = '' 501 PP.pp( rval, result ) 500 502 end 501 503 rescue Exception => err … … 505 507 result = err.message + "\n\t" + nicetrace 506 508 ensure 507 puts result 509 divider 510 message result + "\n" 511 divider 512 $deferr.puts 508 513 end 509 514 end
