Class: ActiveSupport::MessageEncryptor

Inherits:
Object
  • Object
show all
Defined in:
lib/brick.rb

Instance Method Summary collapse

Instance Method Details

#encrypt_and_sign(value, *args, expires_at: nil, expires_in: nil, purpose: nil) ⇒ Object



1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
# File 'lib/brick.rb', line 1839

def encrypt_and_sign(value, *args, expires_at: nil, expires_in: nil, purpose: nil)
  encrypted = if method(:_encrypt).arity == 1
                _encrypt(value) # Rails <= 5.1
              else
                if args.last.is_a?(Hash)
                  expires_at ||= args.last[:expires_at]
                  expires_in ||= args.last[:expires_in]
                  purpose ||= args.last[:purpose]
                end
                _encrypt(value, expires_at: expires_at, expires_in: expires_in, purpose: purpose)
              end
  verifier.generate(encrypted)
end