Class Gem::DigestAdapter
In: lib/rubygems/digest/digest_adapter.rb
Parent: Object

There is an incompatibility between the way Ruby 1.8.5 and 1.8.6 handles digests. This DigestAdapter will take a pre-1.8.6 digest and adapt it to the 1.8.6 API.

Note that only the digest and hexdigest methods are adapted, since these are the only functions used by Gems.

Methods

digest   hexdigest   new   new  

Public Class methods

Initialize a digest adapter.

[Source]

    # File lib/rubygems/digest/digest_adapter.rb, line 20
20:     def initialize(digest_class)
21:       @digest_class = digest_class
22:     end

Public Instance methods

Return the digest of string as a binary string.

[Source]

    # File lib/rubygems/digest/digest_adapter.rb, line 36
36:     def digest(string)
37:       @digest_class.new(string).digest
38:     end

Return the digest of string as a hex string.

[Source]

    # File lib/rubygems/digest/digest_adapter.rb, line 31
31:     def hexdigest(string)
32:       @digest_class.new(string).hexdigest
33:     end

Return a new digester. Since we are only implementing the stateless methods, we will return ourself as the instance.

[Source]

    # File lib/rubygems/digest/digest_adapter.rb, line 26
26:     def new
27:       self
28:     end

[Validate]