aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlyssa Ross2017-05-22 20:35:15 +0100
committerAlyssa Ross2017-05-22 20:39:17 +0100
commitb01a9b0695151db8f023a119558065bc38933c20 (patch)
treeb4d199e7bf2da497ff83d0312f85399a3b34a636
parentdd5d4880dc8518a987a5f0f0cbc43399180b7396 (diff)
downloadbrew-b01a9b0695151db8f023a119558065bc38933c20.tar.bz2
patch: clean up with Forwardable
-rw-r--r--Library/Homebrew/patch.rb30
1 files changed, 6 insertions, 24 deletions
diff --git a/Library/Homebrew/patch.rb b/Library/Homebrew/patch.rb
index 1b7751ba3..7f5a6af35 100644
--- a/Library/Homebrew/patch.rb
+++ b/Library/Homebrew/patch.rb
@@ -108,8 +108,14 @@ class StringPatch < EmbeddedPatch
end
class ExternalPatch
+ extend Forwardable
+
attr_reader :resource, :strip
+ def_delegators :resource,
+ :url, :fetch, :patch_files, :verify_download_integrity, :cached_download,
+ :clear_cache
+
def initialize(strip, &block)
@strip = strip
@resource = Resource::Patch.new(&block)
@@ -148,30 +154,6 @@ class ExternalPatch
end
end
- def url
- resource.url
- end
-
- def fetch
- resource.fetch
- end
-
- def patch_files
- resource.patch_files
- end
-
- def verify_download_integrity(fn)
- resource.verify_download_integrity(fn)
- end
-
- def cached_download
- resource.cached_download
- end
-
- def clear_cache
- resource.clear_cache
- end
-
def inspect
"#<#{self.class.name}: #{strip.inspect} #{url.inspect}>"
end