Sha256: d2672c9495beb248f5df1a4702413a274f598513d0b9ffd15798af2d0d2b7872
Contents?: true
Size: 625 Bytes
Versions: 6
Compression:
Stored size: 625 Bytes
Contents
require 'saorin/error' module Saorin module Adapters module Registerable class << self def included(base) base.extend ClassMethods end end module ClassMethods attr_accessor :load_path def adapters @adapters ||= {} end def register(key, adapter) adapters[key.to_s] = adapter end def guess(key) key = key.to_s require "#{load_path}/#{key}" adapter = adapters[key] raise AdapterNotFound, key unless adapter adapter end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems