diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2017-07-23 11:03:25 -0500 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2017-07-23 11:03:25 -0500 |
commit | 8f20624820ed0922b33fceb4013d3ff11015b366 (patch) | |
tree | 87e3110aba4849fc815f0dd12534982ee2b9aa9e /app/models | |
parent | 9e81741b342a1a8a1ace94d356e023031d386689 (diff) | |
download | rails-8f20624820ed0922b33fceb4013d3ff11015b366.tar.gz rails-8f20624820ed0922b33fceb4013d3ff11015b366.tar.bz2 rails-8f20624820ed0922b33fceb4013d3ff11015b366.zip |
Switch to a single message verifier
No need for this proliferation
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/active_storage/variation.rb | 6 | ||||
-rw-r--r-- | app/models/active_storage/verified_key_with_expiration.rb | 6 |
2 files changed, 4 insertions, 8 deletions
diff --git a/app/models/active_storage/variation.rb b/app/models/active_storage/variation.rb index f7c81bb99a..b37397fcad 100644 --- a/app/models/active_storage/variation.rb +++ b/app/models/active_storage/variation.rb @@ -2,17 +2,15 @@ require "active_support/core_ext/object/inclusion" # A set of transformations that can be applied to a blob to create a variant. class ActiveStorage::Variation - class_attribute :verifier - attr_reader :transformations class << self def decode(key) - new verifier.verify(key) + new ActiveStorage.verifier.verify(key) end def encode(transformations) - verifier.generate(transformations) + ActiveStorage.verifier.generate(transformations) end end diff --git a/app/models/active_storage/verified_key_with_expiration.rb b/app/models/active_storage/verified_key_with_expiration.rb index 4a46483db5..5cb07c6988 100644 --- a/app/models/active_storage/verified_key_with_expiration.rb +++ b/app/models/active_storage/verified_key_with_expiration.rb @@ -1,13 +1,11 @@ class ActiveStorage::VerifiedKeyWithExpiration - class_attribute :verifier - class << self def encode(key, expires_in: nil) - verifier.generate([ key, expires_at(expires_in) ]) + ActiveStorage.verifier.generate([ key, expires_at(expires_in) ]) end def decode(encoded_key) - key, expires_at = verifier.verified(encoded_key) + key, expires_at = ActiveStorage.verifier.verified(encoded_key) key if key && fresh?(expires_at) end |