Module: EncryptAttributes
- Defined in:
- lib/encrypt_attributes.rb,
lib/encrypt_attributes/model.rb,
lib/encrypt_attributes/macros.rb,
lib/encrypt_attributes/version.rb,
lib/encrypt_attributes/adapters.rb,
lib/encrypt_attributes/encryptor.rb,
lib/encrypt_attributes/adapters/base.rb,
lib/encrypt_attributes/adapters/mongoid.rb,
lib/encrypt_attributes/adapters/active_record.rb
Defined Under Namespace
Modules: Adapters, Macros, Model
Classes: Encryptor, MissingAdapterError
Constant Summary
collapse
- VERSION =
"0.0.1"
Class Method Summary
collapse
Class Method Details
.adapters ⇒ Object
20
21
22
|
# File 'lib/encrypt_attributes.rb', line 20
def adapters
@adapters ||= {}
end
|
.find_adapter(base) ⇒ Object
8
9
10
11
12
13
14
|
# File 'lib/encrypt_attributes.rb', line 8
def find_adapter(base)
adapter = adapters.find do |receiver, adapter|
base.ancestors.map(&:to_s).include?(receiver)
end.try(:last)
adapter || (raise MissingAdapterError)
end
|
.register_adapter(receiver, adapter) ⇒ Object
16
17
18
|
# File 'lib/encrypt_attributes.rb', line 16
def register_adapter(receiver, adapter)
adapters[receiver] = adapter
end
|