Module: Mobility::Backends

Defined in:
lib/mobility/backends.rb,
lib/mobility/backends/hash.rb,
lib/mobility/backends/json.rb,
lib/mobility/backends/null.rb,
lib/mobility/backends/jsonb.rb,
lib/mobility/backends/table.rb,
lib/mobility/backends/column.rb,
lib/mobility/backends/hstore.rb,
lib/mobility/backends/sequel.rb,
lib/mobility/backends/container.rb,
lib/mobility/backends/key_value.rb,
lib/mobility/backends/serialized.rb,
lib/mobility/backends/hash_valued.rb,
lib/mobility/backends/sequel/json.rb,
lib/mobility/backends/sequel/jsonb.rb,
lib/mobility/backends/sequel/table.rb,
lib/mobility/backends/active_record.rb,
lib/mobility/backends/sequel/column.rb,
lib/mobility/backends/sequel/hstore.rb,
lib/mobility/backends/sequel/pg_hash.rb,
lib/mobility/backends/sequel/container.rb,
lib/mobility/backends/sequel/key_value.rb,
lib/mobility/backends/sequel/serialized.rb,
lib/mobility/backends/active_record/json.rb,
lib/mobility/backends/active_record/jsonb.rb,
lib/mobility/backends/active_record/table.rb,
lib/mobility/backends/active_record/column.rb,
lib/mobility/backends/active_record/hstore.rb,
lib/mobility/backends/active_record/pg_hash.rb,
lib/mobility/backends/active_record/container.rb,
lib/mobility/backends/active_record/key_value.rb,
lib/mobility/backends/active_record/serialized.rb

Defined Under Namespace

Modules: ActiveRecord, Column, Container, Hstore, Json, Jsonb, KeyValue, Sequel, Serialized, Table Classes: Hash, LoadError, Null

Class Method Summary collapse

Class Method Details

.load_backend(name) ⇒ Object

Parameters:

  • backend (Symbol, Object)

    Name of backend to load.



7
8
9
10
11
12
13
14
15
# File 'lib/mobility/backends.rb', line 7

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

.register_backend(name, mod) ⇒ Object



18
19
20
# File 'lib/mobility/backends.rb', line 18

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