require 'delegate' require 'uri' module Khronos class Storage < Delegator attr_reader :uri, :adapter def initialize(url=ENV['KHRONOS_STORAGE']) unless url.nil? @uri = URI.parse(url) require "khronos/adapter/#{@uri.scheme}" __setobj__(Adapter.const_get(@uri.scheme.capitalize).new(@uri)) end end def __getobj__ @adapter end def __setobj__(adapter) @adapter = adapter end end end