Class: ActiveRecordEncryption::Encryptor::Registration
- Inherits:
-
Object
- Object
- ActiveRecordEncryption::Encryptor::Registration
- Defined in:
- lib/active_record_encryption/encryptor/registry.rb
Instance Method Summary collapse
- #call(_registry, *args, **kwargs) ⇒ Object
-
#initialize(name, block) ⇒ Registration
constructor
A new instance of Registration.
- #matches?(encryptor_name, *_args, **_kwargs) ⇒ Boolean
Constructor Details
#initialize(name, block) ⇒ Registration
Returns a new instance of Registration.
18 19 20 21 |
# File 'lib/active_record_encryption/encryptor/registry.rb', line 18 def initialize(name, block, **) @name = name @block = block end |
Instance Method Details
#call(_registry, *args, **kwargs) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/active_record_encryption/encryptor/registry.rb', line 23 def call(_registry, *args, **kwargs) if kwargs.any? # https://bugs.ruby-lang.org/issues/10856 block.call(*args, **kwargs) else block.call(*args) end end |
#matches?(encryptor_name, *_args, **_kwargs) ⇒ Boolean
31 32 33 |
# File 'lib/active_record_encryption/encryptor/registry.rb', line 31 def matches?(encryptor_name, *_args, **_kwargs) encryptor_name == name end |