Document Patch.

This commit is contained in:
Markus Reiter 2020-08-17 20:06:08 +02:00
parent 3a04377b51
commit b9894e2241

View File

@ -3,6 +3,9 @@
require "resource"
require "erb"
# Helper module for creating patches.
#
# @api private
module Patch
def self.create(strip, src, &block)
case strip
@ -52,6 +55,9 @@ module Patch
end
end
# An abstract class representing a patch embedded into a formula.
#
# @api private
class EmbeddedPatch
attr_writer :owner
attr_reader :strip
@ -77,6 +83,9 @@ class EmbeddedPatch
end
end
# A patch at the `__END__` of a formula file.
#
# @api private
class DATAPatch < EmbeddedPatch
attr_accessor :path
@ -100,6 +109,9 @@ class DATAPatch < EmbeddedPatch
end
end
# A string containing a patch.
#
# @api private
class StringPatch < EmbeddedPatch
def initialize(strip, str)
super(strip)
@ -111,6 +123,9 @@ class StringPatch < EmbeddedPatch
end
end
# A string containing a patch.
#
# @api private
class ExternalPatch
extend Forwardable
@ -170,7 +185,11 @@ class ExternalPatch
end
end
# A legacy patch.
#
# Legacy patches have no checksum and are not cached.
#
# @api private
class LegacyPatch < ExternalPatch
def initialize(strip, url)
odeprecated "legacy patches", "'patch do' blocks"