Class: DATAPatch Private

Inherits:
EmbeddedPatch show all
Defined in:
Library/Homebrew/patch.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

A patch at the __END__ of a formula file.

Instance Attribute Summary collapse

Attributes inherited from EmbeddedPatch

#owner, #strip

Instance Method Summary collapse

Methods inherited from EmbeddedPatch

#apply, #external?, #inspect

Constructor Details

#initialize(strip) ⇒ DATAPatch

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of DATAPatch.


92
93
94
95
# File 'Library/Homebrew/patch.rb', line 92

def initialize(strip)
  super
  @path = nil
end

Instance Attribute Details

#pathObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


90
91
92
# File 'Library/Homebrew/patch.rb', line 90

def path
  @path
end

Instance Method Details

#contentsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'Library/Homebrew/patch.rb', line 97

def contents
  data = +""
  path.open("rb") do |f|
    loop do
      line = f.gets
      break if line.nil? || line =~ /^__END__$/
    end
    while line = f.gets
      data << line
    end
  end
  data.freeze
end