Class: ActiveSupport::Digest

Inherits:
Object
  • Object
show all
Defined in:
activesupport/lib/active_support/digest.rb

Overview

:nodoc:

Class Method Summary collapse

Class Method Details

.hash_digest_classObject


6
7
8
# File 'activesupport/lib/active_support/digest.rb', line 6

def hash_digest_class
  @hash_digest_class ||= ::Digest::MD5
end

.hash_digest_class=(klass) ⇒ Object

Raises:

  • (ArgumentError)

10
11
12
13
# File 'activesupport/lib/active_support/digest.rb', line 10

def hash_digest_class=(klass)
  raise ArgumentError, "#{klass} is expected to implement hexdigest class method" unless klass.respond_to?(:hexdigest)
  @hash_digest_class = klass
end

.hexdigest(arg) ⇒ Object


15
16
17
# File 'activesupport/lib/active_support/digest.rb', line 15

def hexdigest(arg)
  hash_digest_class.hexdigest(arg)[0...32]
end