aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorEileen M. Uchitelle <eileencodes@users.noreply.github.com>2017-12-18 09:59:13 -0500
committerGitHub <noreply@github.com>2017-12-18 09:59:13 -0500
commitb2be83fc2c7e8390500e78ba443ef802374e83a0 (patch)
tree70c24c132aa922629d9bb8de5048c0173a00f93a /activesupport/lib
parent95117a2ce234c381180429b5b8161fdb44843f30 (diff)
parentb9e7c676ca13e286a371dc1b4996d2c15c0461e8 (diff)
downloadrails-b2be83fc2c7e8390500e78ba443ef802374e83a0.tar.gz
rails-b2be83fc2c7e8390500e78ba443ef802374e83a0.tar.bz2
rails-b2be83fc2c7e8390500e78ba443ef802374e83a0.zip
Merge pull request #31490 from eugeneius/hash_digest_class_truncate
Don't include ellipsis in truncated digest output
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/digest.rb10
-rw-r--r--activesupport/lib/active_support/railtie.rb4
2 files changed, 3 insertions, 11 deletions
diff --git a/activesupport/lib/active_support/digest.rb b/activesupport/lib/active_support/digest.rb
index d77eeb072b..fba10fbdcf 100644
--- a/activesupport/lib/active_support/digest.rb
+++ b/activesupport/lib/active_support/digest.rb
@@ -13,16 +13,8 @@ module ActiveSupport
end
def hexdigest(arg)
- new.hexdigest(arg)
+ hash_digest_class.hexdigest(arg)[0...32]
end
end
-
- def initialize(digest_class: nil)
- @digest_class = digest_class || self.class.hash_digest_class
- end
-
- def hexdigest(arg)
- @digest_class.hexdigest(arg).truncate(32)
- end
end
end
diff --git a/activesupport/lib/active_support/railtie.rb b/activesupport/lib/active_support/railtie.rb
index 3488721df9..91872e29c8 100644
--- a/activesupport/lib/active_support/railtie.rb
+++ b/activesupport/lib/active_support/railtie.rb
@@ -68,9 +68,9 @@ module ActiveSupport
end
initializer "active_support.set_hash_digest_class" do |app|
- if app.config.active_support.respond_to?(:use_hash_digest_class) && app.config.active_support.use_hash_digest_class
+ if app.config.active_support.respond_to?(:hash_digest_class) && app.config.active_support.hash_digest_class
ActiveSupport::Digest.hash_digest_class =
- app.config.active_support.use_hash_digest_class
+ app.config.active_support.hash_digest_class
end
end
end