Module: Ork::Encryption
- Defined in:
- lib/ork/encryption.rb,
lib/ork/serializers/json.rb,
lib/ork/cipher.rb
Defined Under Namespace
Modules: Serializers Classes: Cipher, MissingConfig
Constant Summary collapse
- VERSION =
'0.0.2'
Class Method Summary collapse
-
.encryption_config(config = nil) ⇒ Object
Accessor for the general Encryptor config.
- .included(klass) ⇒ Object
-
.init(config) ⇒ Object
Initializes the module, setting a configuration and registering the serializers into Riak API.
Class Method Details
.encryption_config(config = nil) ⇒ Object
Accessor for the general Encryptor config.
config - When nil, it acts like a reader.
When hash, it needs :key and :cipher
Raises Ork::Encryption::MissingConfig when the config is incomplete.
30 31 32 33 34 |
# File 'lib/ork/encryption.rb', line 30 def self.encryption_config(config = nil) return @encryption_config if config.nil? Ork::Encryption::Cipher.validate_config @encryption_config = config end |
.included(klass) ⇒ Object
8 9 10 11 |
# File 'lib/ork/encryption.rb', line 8 def self.included(klass) raise Ork::NotOrkObject unless klass.included_modules.include? Ork::Document klass.content_type Serializers::Json.content_type end |
.init(config) ⇒ Object
Initializes the module, setting a configuration and registering the serializers into Riak API.
17 18 19 20 21 |
# File 'lib/ork/encryption.rb', line 17 def self.init(config) Serializers::Json.register! encryption_config config end |