I’ve had to shim File.write
a couple times into scripts that might run under 1.8.7 (the version OSX shipped with prior
to Mavericks).
It’s a pretty easy back-port:
1 | unless File.respond_to?(:write) |
It’s better to use respond_to
when determining if you need to poly-fill rather than
RUBY_VERSION
or something.
Maybe I should just always use the block method I wouldn’t have to keep doing this.
At least this is easier than switching all your hash literal syntax.