Skip to content

Commit 836e380

Browse files
Format Encryptor docs [ci-skip]
1 parent be61803 commit 836e380

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

activerecord/lib/active_record/encryption/encryptor.rb

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,16 @@ class Encryptor
1414
# The compressor to use for compressing the payload.
1515
attr_reader :compressor
1616

17-
# === Options
17+
# ==== Options
1818
#
19-
# * <tt>:compress</tt> - Boolean indicating whether records should be compressed before encryption.
20-
# Defaults to +true+.
21-
# * <tt>:compressor</tt> - The compressor to use. It must respond to +deflate+ and +inflate+.
22-
# If not provided, will default to +ActiveRecord::Encryption.config.compressor+, which itself defaults to +Zlib+.
19+
# [+:compress+]
20+
# Boolean indicating whether records should be compressed before
21+
# encryption. Defaults to +true+.
22+
#
23+
# [+:compressor+]
24+
# The compressor to use. It must respond to +deflate+ and +inflate+.
25+
# If not provided, will default to +ActiveRecord::Encryption.config.compressor+,
26+
# which itself defaults to +Zlib+.
2327
def initialize(compress: true, compressor: nil)
2428
@compress = compress
2529
@compressor = compressor || ActiveRecord::Encryption.config.compressor
@@ -31,17 +35,17 @@ def initialize(compress: true, compressor: nil)
3135
#
3236
# 1. Create a new ActiveRecord::Encryption::Message.
3337
# 2. Compress and encrypt +clean_text+ as the message payload.
34-
# 3. Serialize it with +ActiveRecord::Encryption.message_serializer+ (+ActiveRecord::Encryption::SafeMarshal+
35-
# by default).
38+
# 3. Serialize it with +ActiveRecord::Encryption.message_serializer+
39+
# (+ActiveRecord::Encryption::SafeMarshal+ by default).
3640
# 4. Encode the result with Base64.
3741
#
38-
# === Options
42+
# ==== Options
3943
#
40-
# [:key_provider]
44+
# [+:key_provider+]
4145
# Key provider to use for the encryption operation. It will default to
4246
# +ActiveRecord::Encryption.key_provider+ when not provided.
4347
#
44-
# [:cipher_options]
48+
# [+:cipher_options+]
4549
# Cipher-specific options that will be passed to the Cipher configured in
4650
# +ActiveRecord::Encryption.cipher+.
4751
def encrypt(clear_text, key_provider: default_key_provider, cipher_options: {})
@@ -53,13 +57,13 @@ def encrypt(clear_text, key_provider: default_key_provider, cipher_options: {})
5357

5458
# Decrypts an +encrypted_text+ and returns the result as clean text.
5559
#
56-
# === Options
60+
# ==== Options
5761
#
58-
# [:key_provider]
62+
# [+:key_provider+]
5963
# Key provider to use for the encryption operation. It will default to
6064
# +ActiveRecord::Encryption.key_provider+ when not provided.
6165
#
62-
# [:cipher_options]
66+
# [+:cipher_options+]
6367
# Cipher-specific options that will be passed to the Cipher configured in
6468
# +ActiveRecord::Encryption.cipher+.
6569
def decrypt(encrypted_text, key_provider: default_key_provider, cipher_options: {})

0 commit comments

Comments
 (0)