Class: ActiveSupport::Digest

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

Overview

:nodoc:

Class Method Summary collapse

Class Method Details

.hash_digest_classObject



8
9
10
# File 'lib/active_support/digest.rb', line 8

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

.hash_digest_class=(klass) ⇒ Object

Raises:

  • (ArgumentError)


12
13
14
15
# File 'lib/active_support/digest.rb', line 12

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



17
18
19
# File 'lib/active_support/digest.rb', line 17

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