This works on Unix, but when I move it over to Windows 7 (machine that script will be run on), using both Ruby 2.1 and 2.2, it fails.
This works (on Windows):
date = Time.new.localtime.to_s
file = File.new("somefile #{1 + 1}", 'a')
file.close
This does not work (on Windows):
date = Time.new.localtime.to_s
file = File.new("somefile #{date}", 'a')
file.close
The resulting error is:
test.rb:2:in 'initialize': Invalid argument @ rb_sysopen - somefile 2015-12-07 11:17:52 -0500 (Errno::EINVAL)
from test.rb:2:in 'new'
from test.rb:2:in '<main>'
Any ideas on why this is the case?