Class: Kinko::Adapters::ROM::Plugin::Config
- Inherits:
-
Object
- Object
- Kinko::Adapters::ROM::Plugin::Config
- Defined in:
- lib/kinko/adapters/rom/plugin.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#encrypted ⇒ Object
readonly
Returns the value of attribute encrypted.
-
#indexed ⇒ Object
readonly
Returns the value of attribute indexed.
-
#normalizers ⇒ Object
readonly
Returns the value of attribute normalizers.
Instance Method Summary collapse
- #blind_index(source, to:, normalize: :none) ⇒ Object
- #decrypt_output(tuple) ⇒ Object
- #encrypt(source, to:, index: nil, normalize: :none, type: nil) ⇒ Object
- #encrypt_input(tuple) ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
16 17 18 19 20 |
# File 'lib/kinko/adapters/rom/plugin.rb', line 16 def initialize @encrypted = [] @indexed = [] @normalizers = {} end |
Instance Attribute Details
#encrypted ⇒ Object (readonly)
Returns the value of attribute encrypted.
14 15 16 |
# File 'lib/kinko/adapters/rom/plugin.rb', line 14 def encrypted @encrypted end |
#indexed ⇒ Object (readonly)
Returns the value of attribute indexed.
14 15 16 |
# File 'lib/kinko/adapters/rom/plugin.rb', line 14 def indexed @indexed end |
#normalizers ⇒ Object (readonly)
Returns the value of attribute normalizers.
14 15 16 |
# File 'lib/kinko/adapters/rom/plugin.rb', line 14 def normalizers @normalizers end |
Instance Method Details
#blind_index(source, to:, normalize: :none) ⇒ Object
27 28 29 30 |
# File 'lib/kinko/adapters/rom/plugin.rb', line 27 def blind_index(source, to:, normalize: :none) @indexed << Indexed.new(source:, to:, normalize:) @normalizers[to] = normalize end |
#decrypt_output(tuple) ⇒ Object
39 40 41 42 43 |
# File 'lib/kinko/adapters/rom/plugin.rb', line 39 def decrypt_output(tuple) result = tuple.to_h.dup @encrypted.each { apply_decrypt(_1, result) if result.key?(_1.to) } result end |
#encrypt(source, to:, index: nil, normalize: :none, type: nil) ⇒ Object
22 23 24 25 |
# File 'lib/kinko/adapters/rom/plugin.rb', line 22 def encrypt(source, to:, index: nil, normalize: :none, type: nil) @encrypted << Encrypted.new(source:, to:, index:, normalize:, type:) @normalizers[index] = normalize if index end |
#encrypt_input(tuple) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/kinko/adapters/rom/plugin.rb', line 32 def encrypt_input(tuple) result = tuple.to_h.dup @encrypted.each { apply_encrypt(_1, result) if result.key?(_1.source) } @indexed.each { apply_index(_1, result) if result.key?(_1.source) } result end |