Sha256: 6a572955127da37672fdbc2a3b54eccc227f331eca01bfa5fbf5084e17e2f307

Contents?: true

Size: 824 Bytes

Versions: 3

Compression:

Stored size: 824 Bytes

Contents

# coding: utf-8
Dir[File.dirname(__FILE__) + '/backends/*.rb'].each {|file| require file  }

# base Splash Module
module Splash

  # generic backends module
  module Backends
    include Splash::Config
    include Splash::Constants

    # factory for backend
    # @param [Symbol] store the name of the store actually in [:execution_trace]
    # @return [Splash::Backends::<Type>|Hash] with type in [:redis,:file] or Exiter case :configuration_error 
    def get_backend(store)
      backend = get_config[:backends][:stores][store][:type].to_s
      aclass = "Splash::Backends::#{backend.capitalize}"
      begin
        return Kernel.const_get(aclass)::new(store)
      rescue
        splash_exit case: :configuration_error, more: "Backend specified for store #{store} inexistant : #{backend}"
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
prometheus-splash-0.7.0 lib/splash/backends.rb
prometheus-splash-0.6.1 lib/splash/backends.rb
prometheus-splash-0.6.0 lib/splash/backends.rb