Use a write method which is compatible with older Ruby versions.

File.write (IO.write) is only available in Ruby 1.9.3 and above.
Use curly braces instead.
Merge pull request #2 from Kami/fix_ruby_compatibility

Fix compatibility with older versions of Ruby (< 1.9.2).