Sha256: 02b7e1dbb37a28b846079f80f60f641b49773c7d9dcd99a0b98ceaae0b19f4cb

Contents?: true

Size: 612 Bytes

Versions: 30

Compression:

Stored size: 612 Bytes

Contents

module Mobility
  module Backends
    @backends = {}

    class << self
      # @param [Symbol, Object] backend Name of backend to load.
      def load_backend(name)
        return name if Module === name || name.nil?

        unless (backend = @backends[name])
          require "mobility/backends/#{name}"
          raise LoadError, "backend #{name} did not register itself correctly in Mobility::Backends" unless (backend = @backends[name])
        end
        backend
      end
    end

    def self.register_backend(name, mod)
      @backends[name] = mod
    end

    class LoadError < Error; end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
mobility-1.3.1 lib/mobility/backends.rb
mobility-1.3.0 lib/mobility/backends.rb
mobility-1.3.0.rc3 lib/mobility/backends.rb
mobility-1.3.0.rc2 lib/mobility/backends.rb
mobility-1.3.0.rc1 lib/mobility/backends.rb
mobility-1.2.9 lib/mobility/backends.rb
mobility-1.2.8 lib/mobility/backends.rb
mobility-1.2.7 lib/mobility/backends.rb
mobility-1.2.6 lib/mobility/backends.rb
mobility-1.2.5 lib/mobility/backends.rb
mobility-1.2.4 lib/mobility/backends.rb
mobility-1.2.3 lib/mobility/backends.rb
mobility-1.2.2 lib/mobility/backends.rb
mobility-1.2.1 lib/mobility/backends.rb
mobility-1.2.0 lib/mobility/backends.rb
mobility-1.1.3 lib/mobility/backends.rb
mobility-1.1.2 lib/mobility/backends.rb
mobility-1.1.1 lib/mobility/backends.rb
mobility-1.1.0 lib/mobility/backends.rb
mobility-1.0.7 lib/mobility/backends.rb