Sha256: 78d8ce03fbaf121b4210f71d89ab2b64244af1a2e56689ba60cc432cb8814dea
Contents?: true
Size: 823 Bytes
Versions: 6
Compression:
Stored size: 823 Bytes
Contents
require 'thread_safe' require 'rom/http/dataset' module ROM module HTTP class Gateway < ROM::Gateway attr_reader :datasets, :config private :datasets, :config def initialize(config) @datasets = ThreadSafe::Cache.new @config = config end def [](name) datasets.fetch(name) end def dataset(name) dataset_klass = namespace.const_defined?(:Dataset) ? namespace.const_get(:Dataset) : Dataset datasets[name] = dataset_klass.new(config.merge(name: name)) end def dataset?(name) datasets.key?(name) end private def namespace self.class.to_s[/(.*)(?=::)/].split('::').inject(::Object) do |constant, const_name| constant.const_get(const_name) end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems