On 28.06.2007 07:35, Phrogz wrote:
> On Jun 27, 7:33 pm, Frank Church <vfcfor... / gmail.com> wrote:
>> f = File.new(configfile, File::CREAT|File::WRONLY, 0700)
>> header_commands.each {|x| f.puts x }
>> mysql_commands.each {|x| f.puts x }
>> dir_commands.each {|x| f.puts x }
>> scp_commands.each {|x| f.puts x }
> 
> File.new( configfile, File::CREAT|File::WRONLY, 0700){ |f|
>   f.puts [ header_commands, mysql_commands, dir_commands,
> scp_commands ].flatten
> }
> 
> (Since puts will already join the array with \n)

I believe there is an even simpler solution:

File.open configfile, File::CREAT|File::WRONLY, 0700 do |f|
   f.puts header_commands,
     mysql_commands,
     dir_commands,
     scp_commands
end

:-)

Kind regards

	robert