Class: DATAPatch

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

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

Returns a new instance of DATAPatch



83
84
85
86
# File 'brew/Library/Homebrew/patch.rb', line 83

def initialize(strip)
  super
  @path = nil
end

Instance Attribute Details

#pathObject

Returns the value of attribute path



81
82
83
# File 'brew/Library/Homebrew/patch.rb', line 81

def path
  @path
end

Instance Method Details

#contentsObject



88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'brew/Library/Homebrew/patch.rb', line 88

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