Merge pull request #2666 from alyssais/patch_forwardable

patch: clean up with Forwardable
This commit is contained in:
Alyssa Ross 2017-05-23 10:18:56 +01:00 committed by GitHub
commit 04420d07a4

View File

@ -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