Class: EmbeddedPatch

Inherits:
Object
  • Object
show all
Defined in:
brew/Library/Homebrew/patch.rb

Direct Known Subclasses

DATAPatch, StringPatch

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(strip) ⇒ EmbeddedPatch

Returns a new instance of EmbeddedPatch



59
60
61
# File 'brew/Library/Homebrew/patch.rb', line 59

def initialize(strip)
  @strip = strip
end

Instance Attribute Details

#owner=(value) ⇒ Object (writeonly)

Sets the attribute owner

Parameters:

  • value

    the value to set the attribute owner to.



56
57
58
# File 'brew/Library/Homebrew/patch.rb', line 56

def owner=(value)
  @owner = value
end

#stripObject (readonly)

Returns the value of attribute strip



57
58
59
# File 'brew/Library/Homebrew/patch.rb', line 57

def strip
  @strip
end

Instance Method Details

#applyObject



69
70
71
72
73
# File 'brew/Library/Homebrew/patch.rb', line 69

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



67
# File 'brew/Library/Homebrew/patch.rb', line 67

def contents; end

#external?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'brew/Library/Homebrew/patch.rb', line 63

def external?
  false
end

#inspectObject



75
76
77
# File 'brew/Library/Homebrew/patch.rb', line 75

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