Class: DATAPatch Private
- Inherits:
-
EmbeddedPatch
- Object
- EmbeddedPatch
- DATAPatch
- Defined in:
- patch.rb
Overview
This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.
A patch at the __END__ of a formula file.
Instance Attribute Summary collapse
- #path ⇒ Pathname? private
Attributes inherited from EmbeddedPatch
Instance Method Summary collapse
- #contents ⇒ String private
- #initialize(strip) ⇒ void constructor private
Methods inherited from EmbeddedPatch
Methods included from Utils::Output::Mixin
#odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_outside_github_actions, #pretty_duration, #pretty_installed, #pretty_outdated, #pretty_uninstalled
Constructor Details
#initialize(strip) ⇒ void
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.
88 89 90 91 |
# File 'patch.rb', line 88 def initialize(strip) super @path = T.let(nil, T.nilable(Pathname)) end |
Instance Attribute Details
#path ⇒ Pathname?
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.
85 86 87 |
# File 'patch.rb', line 85 def path @path end |
Instance Method Details
#contents ⇒ String
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.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'patch.rb', line 94 def contents path = self.path raise ArgumentError, "DATAPatch#contents called before path was set!" unless path data = +"" path.open("rb") do |f| loop do line = f.gets break if line.nil? || /^__END__$/.match?(line) end while (line = f.gets) data << line end end data.freeze end |