Module: WriteMkpathExtension Private

Extended by:
T::Helpers
Defined in:
extend/pathname/write_mkpath_extension.rb

This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.

Instance Method Summary collapse

Instance Method Details

#write(content, offset = nil, external_encoding: nil, internal_encoding: nil, encoding: nil, textmode: nil, binmode: nil, autoclose: nil, mode: nil, perm: nil) ⇒ Integer

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Source for sig: https://github.com/sorbet/sorbet/blob/b4092efe0a4489c28aff7e1ead6ee8a0179dc8b3/rbi/stdlib/pathname.rbi#L1392-L1411

Parameters:

  • content (Object)
  • offset (Integer, nil) (defaults to: nil)
  • external_encoding (String, Encoding, nil) (defaults to: nil)
  • internal_encoding (String, Encoding, nil) (defaults to: nil)
  • encoding (String, Encoding, nil) (defaults to: nil)
  • textmode (BasicObject) (defaults to: nil)
  • binmode (BasicObject) (defaults to: nil)
  • autoclose (BasicObject) (defaults to: nil)
  • mode (String, nil) (defaults to: nil)
  • perm (Integer, nil) (defaults to: nil)

Returns:



24
25
26
27
28
29
30
31
# File 'extend/pathname/write_mkpath_extension.rb', line 24

def write(content, offset = nil, external_encoding: nil, internal_encoding: nil, encoding: nil, textmode: nil,
          binmode: nil, autoclose: nil, mode: nil, perm: nil)
  raise "Will not overwrite #{self}" if exist? && !offset && !mode&.match?(/^a\+?$/)

  dirname.mkpath

  super
end