Sha256: 6a66e4c16cd2ea0bf16de00f2d638c3dcfc8adc1ab0a14e15ed0879dbbd9e3cd
Contents?: true
Size: 503 Bytes
Versions: 2
Compression:
Stored size: 503 Bytes
Contents
class EroGetter autoload :Downloader, 'ero_getter/downloader' def detect(url) self.class.url_mapping.each_pair do |regex, klazz| return klazz if url.match regex end nil end def download(url) klazz = detect(url) raise unless klazz klazz.new(url).run end class << self def url_mapping @url_mapping ||= {} end def add_mapping(regex, strategy) url_mapping[regex] = strategy end def clean @url_mapping = {} end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ero_getter-0.1.2 | lib/ero_getter.rb |
ero_getter-0.1.1 | lib/ero_getter.rb |