Class: DATAPatch Private

Inherits:
EmbeddedPatch show all
Extended by:
T::Sig
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

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. 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.



74
75
76
77
# File 'patch.rb', line 74

def initialize(strip)
  super
  @path = nil
end

Instance Attribute Details

#pathObject

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.



72
73
74
# File 'patch.rb', line 72

def path
  @path
end

Instance Method Details

#contentsString

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:



80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'patch.rb', line 80

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