Remove use of Forwardable from ExternalPatch

This commit is contained in:
Jack Nagel 2014-03-14 16:12:31 -05:00
parent 86a0373159
commit 251bd707a2

View File

@ -1,7 +1,6 @@
require 'resource' require 'resource'
require 'stringio' require 'stringio'
require 'erb' require 'erb'
require 'forwardable'
class Patch class Patch
def self.create(strip, io=nil, &block) def self.create(strip, io=nil, &block)
@ -85,13 +84,8 @@ class IOPatch < Patch
end end
class ExternalPatch < Patch class ExternalPatch < Patch
extend Forwardable
attr_reader :resource, :strip attr_reader :resource, :strip
def_delegators :@resource, :fetch, :verify_download_integrity,
:cached_download, :clear_cache, :url
def initialize(strip, &block) def initialize(strip, &block)
@strip = strip @strip = strip
@resource = Resource.new(&block) @resource = Resource.new(&block)
@ -113,6 +107,26 @@ class ExternalPatch < Patch
end end
end end
def url
resource.url
end
def fetch
resource.fetch
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 def inspect
"#<#{self.class}: #{strip.inspect} #{url.inspect}>" "#<#{self.class}: #{strip.inspect} #{url.inspect}>"
end end
@ -131,7 +145,7 @@ class LegacyPatch < ExternalPatch
end end
def fetch def fetch
resource.clear_cache clear_cache
super super
end end
@ -142,6 +156,6 @@ class LegacyPatch < ExternalPatch
def apply def apply
super super
ensure ensure
resource.clear_cache clear_cache
end end
end end