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 ⇒ Object private
Attributes inherited from EmbeddedPatch
Instance Method Summary collapse
- #contents ⇒ String private
-
#initialize(strip) ⇒ DATAPatch
constructor
private
A new instance of DATAPatch.
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) ⇒ DATAPatch
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.
Returns a new instance of DATAPatch.
71 72 73 74 |
# File 'patch.rb', line 71 def initialize(strip) super @path = nil end |
Instance Attribute Details
#path ⇒ Object
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.
69 70 71 |
# File 'patch.rb', line 69 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.
77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'patch.rb', line 77 def contents 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 |