Module: EncryptedStore::ActiveRecord::Mixin::ClassMethods

Defined in:
lib/encrypted_store/active_record/mixin.rb

Overview

Class Methods

Instance Method Summary collapse

Instance Method Details

#_encrypted_store_dataObject



25
26
27
# File 'lib/encrypted_store/active_record/mixin.rb', line 25

def _encrypted_store_data
  @_encrypted_store_data ||= {}
end

#attr_encrypted(*args) ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/encrypted_store/active_record/mixin.rb', line 29

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