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 RubyGems.

Methods

digest   hexdigest   new   new  

Public Class methods

Initialize a digest adapter.

[Source]

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

Public Instance methods

Return the digest of string as a binary string.

[Source]

    # File lib/rubygems/digest/digest_adapter.rb, line 44
44:   def digest(string)
45:     @digest_class.new(string).digest
46:   end

Return the digest of string as a hex string.

[Source]

    # File lib/rubygems/digest/digest_adapter.rb, line 37
37:   def hexdigest(string)
38:     @digest_class.new(string).hexdigest
39:   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 30
30:   def new
31:     self
32:   end

[Validate]