Class: DATAPatch

Inherits:
EmbeddedPatch show all
Defined in:
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



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

def initialize(strip)
  super
  @path = nil
end

Instance Attribute Details

#pathObject

Returns the value of attribute path



78
79
80
# File 'Library/Homebrew/patch.rb', line 78

def path
  @path
end

Instance Method Details

#contentsObject



85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'Library/Homebrew/patch.rb', line 85

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
end