From 7e7e4c179b910db5b100b7dc822edba7dd607599 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Wed, 19 Aug 2020 06:58:36 +0200 Subject: [PATCH] Document `Resource`. --- Library/Homebrew/resource.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/resource.rb b/Library/Homebrew/resource.rb index e498069eae..f4753914e0 100644 --- a/Library/Homebrew/resource.rb +++ b/Library/Homebrew/resource.rb @@ -8,6 +8,8 @@ require "mktemp" # Resource is the fundamental representation of an external resource. The # primary formula download, along with other declared resources, are instances # of this class. +# +# @api private class Resource include Context include FileUtils @@ -69,9 +71,11 @@ class Resource end # Verifies download and unpacks it. - # The block may call `|resource,staging| staging.retain!` to retain the staging + # The block may call `|resource, staging| staging.retain!` to retain the staging # directory. Subclasses that override stage should implement the tmp # dir using {Mktemp} so that works with all subtypes. + # + # @api public def stage(target = nil, &block) raise ArgumentError, "target directory or block is required" if !target && block.blank? @@ -211,12 +215,14 @@ class Resource end end + # A resource containing a Go package. class Go < Resource def stage(target) super(target/name) end end + # A resource containing a patch. class PatchResource < Resource attr_reader :patch_files @@ -243,6 +249,8 @@ end # The context in which a {Resource.stage} occurs. Supports access to both # the {Resource} and associated {Mktemp} in a single block argument. The interface # is back-compatible with {Resource} itself as used in that context. +# +# @api private class ResourceStageContext extend Forwardable