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.
35 36 37 38 |
# File 'lib/active_record_encryption/encryptor/registry.rb', line 35 def initialize(name, block, **) @name = name @block = block end |
Instance Method Details
#call(_registry, *args, **kwargs) ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/active_record_encryption/encryptor/registry.rb', line 40 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
48 49 50 |
# File 'lib/active_record_encryption/encryptor/registry.rb', line 48 def matches?(encryptor_name, *_args, **_kwargs) encryptor_name == name end |