summaryrefslogtreecommitdiff
path: root/ext/digest/lib/digest.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-16 20:52:55 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-16 20:52:55 +0000
commitc648243c3d94076959d77a3af3c4b72ebd9268a0 (patch)
tree834881b6937f005f99f53e926da5b6c7660b03cb /ext/digest/lib/digest.rb
parent8638efb23d21484e384dc45f99de4d9c500f2428 (diff)
* ext/digest: Improve documentation of Digest, Digest::HMAC and
Digest::SHA2. Patch by Pete Higgins. [Ruby 1.9 - Bug #4702] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/digest/lib/digest.rb')
-rw-r--r--ext/digest/lib/digest.rb22
1 files changed, 17 insertions, 5 deletions
diff --git a/ext/digest/lib/digest.rb b/ext/digest/lib/digest.rb
index b46cf9e2bd..4a98af2eae 100644
--- a/ext/digest/lib/digest.rb
+++ b/ext/digest/lib/digest.rb
@@ -1,7 +1,7 @@
require 'digest.so'
module Digest
- def self.const_missing(name)
+ def self.const_missing(name) # :nodoc:
case name
when :SHA256, :SHA384, :SHA512
lib = 'digest/sha2.so'
@@ -23,8 +23,8 @@ module Digest
class ::Digest::Class
# creates a digest object and reads a given file, _name_.
#
- # p Digest::SHA256.file("X11R6.8.2-src.tar.bz2").hexdigest
- # # => "f02e3c85572dc9ad7cb77c2a638e3be24cc1b5bea9fdbb0b0299c9668475c534"
+ # p Digest::SHA256.file("X11R6.8.2-src.tar.bz2").hexdigest
+ # # => "f02e3c85572dc9ad7cb77c2a638e3be24cc1b5bea9fdbb0b0299c9668475c534"
def self.file(name)
new.file(name)
end
@@ -53,8 +53,8 @@ module Digest
# If none is given, returns the resulting hash value of the digest
# in a base64 encoded form, keeping the digest's state.
#
- # If a _string_ is given, returns the hash value for the given
- # _string_ in a base64 encoded form, resetting the digest to the
+ # If a +string+ is given, returns the hash value for the given
+ # +string+ in a base64 encoded form, resetting the digest to the
# initial state before and after the process.
#
# In either case, the return value is properly padded with '=' and
@@ -71,6 +71,18 @@ module Digest
end
end
+# call-seq:
+# Digest(name) -> digest_subclass
+#
+# Returns a Digest subclass by +name+.
+#
+# require 'digest'
+#
+# Digest("MD5")
+# # => Digest::MD5
+#
+# Digest("Foo")
+# # => LoadError: library not found for class Digest::Foo -- digest/foo
def Digest(name)
Digest.const_get(name)
end