module EroGetter

Constants

VERSION

Public Class Methods

add_mapping(regex, strategy) click to toggle source
# File lib/ero_getter.rb, line 16
def self.add_mapping(regex, strategy)
  url_mapping[regex] = strategy
end
clean() click to toggle source
# File lib/ero_getter.rb, line 20
def self.clean
  @url_mapping = {}
end
detect(url) click to toggle source
# File lib/ero_getter.rb, line 24
def self.detect(url)
  url_mapping.each_pair do |regex, klazz|
    return klazz if url.match regex
  end
  nil
end
directory() click to toggle source
# File lib/ero_getter.rb, line 6
def self.directory
  path = File.join ENV['HOME'], 'ero_getter'
  puts path unless Dir.exists?(path)
  path
end
download(url) click to toggle source
# File lib/ero_getter.rb, line 31
def self.download(url)
  klazz = detect(url)
  raise unless klazz
  klazz.new(url).run
end
url_mapping() click to toggle source
# File lib/ero_getter.rb, line 12
def self.url_mapping
  @url_mapping ||= {}
end