patch: clean up with Forwardable

This commit is contained in:
Alyssa Ross 2017-05-22 20:35:15 +01:00
parent dd5d4880dc
commit b01a9b0695

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