From: John Carter Date: 2005-04-08T06:24:31+09:00 Subject: Re: Interpolating a string loaded from a text file On Thu, 7 Apr 2005, John Elrick wrote: > Hoping you guys can help out here. Is there any way to interpolate a > string that is loaded dynamically? This is my print help routine, the help file itself is almost book length, and contains a bunch of #{expressions} that retrieve information from the "deliverable_registry" object. (Basically the deliverable_registry object knows what can be done, what the command line options to select those actions, the descriptions of those actions etc...) # Doesn't return. # If STDOUT is a terminal pipe the help file through "less". def print_help_and_exit(deliverable_registry, plaint = "") # Pipe the output through less, unless we are within emacs... outf = STDOUT if STDOUT.stat.chardev?() && ENV['TERM'] != 'dumb' then outf = open( "|less", "w") outf = STDOUT if !outf end eval(" begin outf.puts < details $log_file.print_to_screen = 0 # Don't gibber to the screen about the # early exit from less end ") outf.close if outf != STDOUT # Write the exit reason to the log file.. $log_file.history plaint exit(1) # Catch early exit from less rescue Errno::EPIPE => details $log_file.print_to_screen = 0 end John Carter Phone : (64)(3) 358 6639 Tait Electronics Fax : (64)(3) 359 4632 PO Box 1645 Christchurch Email : john.carter@tait.co.nz New Zealand Refactorers do it a little better every time.