Sha256: e56c06c534320aba242d7825884f05890e196b6b165bae3f62f8d1672b7b752f
Contents?: true
Size: 735 Bytes
Versions: 5
Compression:
Stored size: 735 Bytes
Contents
module LocalPac class PacManager def initialize(paths = default_paths, creator = PacFile) @paths = Array(paths) @creator = creator end def find(name) default = proc { NullPacFile.new } pac_files.find(default) { |f| f.name == File.basename(name, '.pac').to_sym } end private def pac_files @paths.reduce([]) do |memo, path| memo.concat Dir.glob(File.join(path, '*.pac')).collect { |f| @creator.new(f) } end end def default_paths [ File.expand_path(File.join(ENV['HOME'], '.config', 'pacfiles')), File.expand_path(File.join(ENV['HOME'], '.pacfiles')), File.expand_path('../../../files', __FILE__), ] end end end
Version data entries
5 entries across 5 versions & 1 rubygems