Class: EmbeddedPatch Private

Inherits:
Object
  • Object
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.

An abstract class representing a patch embedded into a formula.

Direct Known Subclasses

DATAPatch, StringPatch

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(strip) ⇒ EmbeddedPatch

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



43
44
45
# File 'patch.rb', line 43

def initialize(strip)
  @strip = strip
end

Instance Attribute Details

#owner=(value) ⇒ Object (writeonly)

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.



40
41
42
# File 'patch.rb', line 40

def owner=(value)
  @owner = value
end

#stripObject (readonly)

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.



41
42
43
# File 'patch.rb', line 41

def strip
  @strip
end

Instance Method Details

#applyObject

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.



54
55
56
57
58
# File 'patch.rb', line 54

def apply
  data = contents.gsub("HOMEBREW_PREFIX", HOMEBREW_PREFIX)
  args = %W[-g 0 -f -#{strip}]
  Utils.safe_popen_write("patch", *args) { |p| p.write(data) }
end

#contentsObject

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.



52
# File 'patch.rb', line 52

def contents; end

#external?Boolean

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:

  • (Boolean)


48
49
50
# File 'patch.rb', line 48

def external?
  false
end

#inspectString

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:



61
62
63
# File 'patch.rb', line 61

def inspect
  "#<#{self.class.name}: #{strip.inspect}>"
end