Module: ActiveRecord::Acts::ActsAsSecure::ClassMethods::ActsAsSecureClassMethods

Defined in:
lib/acts_as_secure/acts_as_secure.rb

Instance Method Summary collapse

Instance Method Details

#inherited(sub) ⇒ Object



41
42
43
44
45
46
47
48
49
# File 'lib/acts_as_secure/acts_as_secure.rb', line 41

def inherited(sub)

  [:secure_except, :secure_storage_type, :secure_crypto_provider].each do |p|
    sub.instance_variable_set("@#{ p }", instance_variable_get("@#{ p }"))
  end

  super

end

#secure_columnsObject



61
62
63
# File 'lib/acts_as_secure/acts_as_secure.rb', line 61

def secure_columns
  columns.reject { |col| (col.type != @secure_storage_type) || @secure_except.include?(col.name) }
end

#secure_crypto_providerObject



65
66
67
# File 'lib/acts_as_secure/acts_as_secure.rb', line 65

def secure_crypto_provider
  @secure_crypto_provider
end

#with_crypto_provider(provider) ⇒ Object



51
52
53
54
55
56
57
58
59
# File 'lib/acts_as_secure/acts_as_secure.rb', line 51

def with_crypto_provider(provider)
  begin
    original_provider = @secure_crypto_provider
    @secure_crypto_provider = provider
    yield
  ensure
    @secure_crypto_provider = original_provider
  end
end