Module: Ribbon::EncryptedStore::Mixins::ActiveRecordMixin::ClassMethods

Defined in:
lib/ribbon/encrypted_store/mixins/active_record_mixin.rb

Overview

Module Methods

Instance Method Summary collapse

Instance Method Details

#_encrypted_store_dataObject



32
33
34
# File 'lib/ribbon/encrypted_store/mixins/active_record_mixin.rb', line 32

def _encrypted_store_data
  @_encrypted_store_data ||= {}
end

#attr_encrypted(*args) ⇒ Object



36
37
38
39
40
41
42
43
44
# File 'lib/ribbon/encrypted_store/mixins/active_record_mixin.rb', line 36

def attr_encrypted(*args)
  # Store attrs in class data
  _encrypted_store_data[:encrypted_attributes] = args.map(&:to_sym)

  args.each { |arg|
    define_method(arg) { _encrypted_store_get(arg) }
    define_method("#{arg}=") { |value| _encrypted_store_set(arg, value) }
  }
end