diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2017-09-24 19:46:10 +0200 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2017-09-24 19:46:10 +0200 |
commit | 20ba2e762ceab098371122b0c02b4a90239d2ace (patch) | |
tree | 3e94300b0b921b1224290cbf5a30cd7dc76fa641 /activesupport/lib/active_support | |
parent | 92afe55b179152a5747b70cc5d5375395581b70f (diff) | |
download | rails-20ba2e762ceab098371122b0c02b4a90239d2ace.tar.gz rails-20ba2e762ceab098371122b0c02b4a90239d2ace.tar.bz2 rails-20ba2e762ceab098371122b0c02b4a90239d2ace.zip |
Infer options from the primary verifier.
Spares users from passing in non-changing values explicitly.
[ Michael Coyne & Kasper Timm Hansen ]
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/messages/rotator.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/activesupport/lib/active_support/messages/rotator.rb b/activesupport/lib/active_support/messages/rotator.rb index 21ae643138..e18549d735 100644 --- a/activesupport/lib/active_support/messages/rotator.rb +++ b/activesupport/lib/active_support/messages/rotator.rb @@ -3,9 +3,10 @@ module ActiveSupport module Messages module Rotator # :nodoc: - def initialize(*args) + def initialize(*, **options) super + @options = options @rotations = [] end @@ -24,10 +25,12 @@ module ActiveSupport private def create_rotation(raw_key: nil, raw_signed_key: nil, **options) + options[:cipher] ||= @cipher + self.class.new \ raw_key || extract_key(options), raw_signed_key || extract_signing_key(options), - options.slice(:cipher, :digest, :serializer) + @options.merge(options.slice(:cipher, :digest, :serializer)) end def extract_key(cipher:, salt:, key_generator: nil, secret: nil, **) @@ -53,8 +56,8 @@ module ActiveSupport end private - def create_rotation(raw_key: nil, digest: nil, serializer: nil, **options) - self.class.new(raw_key || extract_key(options), digest: digest, serializer: serializer) + def create_rotation(raw_key: nil, **options) + self.class.new(raw_key || extract_key(options), @options.merge(options.slice(:digest, :serializer))) end def extract_key(key_generator: nil, secret: nil, salt:) |