Module: PGCrypto

Defined in:
lib/pgcrypto.rb,
lib/pgcrypto/key.rb,
lib/pgcrypto/table.rb,
lib/pgcrypto/column.rb,
lib/pgcrypto/adapter.rb,
lib/pgcrypto/railtie.rb,
lib/pgcrypto/key_manager.rb,
lib/pgcrypto/table_manager.rb,
lib/pgcrypto/column_converter.rb,
lib/pgcrypto/has_encrypted_column.rb

Defined Under Namespace

Modules: AdapterMethods, HasEncryptedColumn Classes: Column, ColumnConverter, Key, KeyManager, Railtie, Table, TableManager

Constant Summary collapse

Adapter =
build_adapter!

Class Method Summary collapse

Class Method Details

.[](key) ⇒ Object



8
9
10
# File 'lib/pgcrypto.rb', line 8

def self.[](key)
  (@table_manager ||= TableManager.new)[key]
end

.base_adapterObject



12
13
14
# File 'lib/pgcrypto.rb', line 12

def self.base_adapter
  @base_adapter ||= ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
end

.base_adapter=(base_adapter) ⇒ Object



16
17
18
19
# File 'lib/pgcrypto.rb', line 16

def self.base_adapter=(base_adapter)
  @base_adapter = base_adapter
  rebuild_adapter! if respond_to?(:rebuild_adapter!)
end

.build_adapter!Object



4
5
6
7
8
# File 'lib/pgcrypto/adapter.rb', line 4

def self.build_adapter!
  Class.new(PGCrypto.base_adapter) do
    include PGCrypto::AdapterMethods
  end
end

.keysObject



21
22
23
# File 'lib/pgcrypto.rb', line 21

def self.keys
  @keys ||= KeyManager.new
end

.rebuild_adapter!Object



10
11
12
13
# File 'lib/pgcrypto/adapter.rb', line 10

def self.rebuild_adapter!
  remove_const(:Adapter) if const_defined? :Adapter
  const_set(:Adapter, build_adapter!)
end