Module: AttrCipher

Extended by:
ActiveSupport::Concern
Defined in:
lib/attr_cipher/cipher.rb,
lib/attr_cipher/version.rb,
lib/attr_cipher/attr_cipher.rb

Defined Under Namespace

Modules: ClassMethods, VERSION Classes: Cipher

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.cipherObject

Returns the value of attribute cipher.



8
9
10
# File 'lib/attr_cipher/attr_cipher.rb', line 8

def cipher
  @cipher
end

.secretObject

Returns the value of attribute secret.



9
10
11
# File 'lib/attr_cipher/attr_cipher.rb', line 9

def secret
  @secret
end

Class Method Details

.validate_secret(value) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/attr_cipher/attr_cipher.rb', line 17

def self.validate_secret(value)
  if value.size < 100
    offending_line = caller.reject { |entry|
      entry.include?(__dir__) || entry.include?("forwardable.rb")
    }.first[/^(.*?:\d+)/, 1]
    warn "[attr_cipher] secret must have at least 100 characters (called from #{offending_line})"
  end
end