lib/pdk/util/filesystem.rb in pdk-1.14.0 vs lib/pdk/util/filesystem.rb in pdk-1.14.1
- old
+ new
@@ -1,9 +1,12 @@
+require 'pdk'
+
module PDK
module Util
module Filesystem
def write_file(path, content)
- raise ArgumentError unless path.is_a?(String) || path.respond_to?(:to_path)
+ raise ArgumentError, _('content must be a String') unless content.is_a?(String)
+ raise ArgumentError, _('path must be a String or Pathname') unless path.is_a?(String) || path.respond_to?(:to_path)
# Harmonize newlines across platforms.
content = content.encode(universal_newline: true)
# Make sure all written files have a trailing newline.