summaryrefslogtreecommitdiff
path: root/ext/digest/lib/sha1.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ext/digest/lib/sha1.rb')
-rw-r--r--ext/digest/lib/sha1.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/ext/digest/lib/sha1.rb b/ext/digest/lib/sha1.rb
index c4ac6f66ea..c7cf51439f 100644
--- a/ext/digest/lib/sha1.rb
+++ b/ext/digest/lib/sha1.rb
@@ -7,8 +7,17 @@ require 'digest/sha1'
SHA1 = Digest::SHA1
-class SHA1
- def self.sha1(*args)
+class << SHA1
+ alias orig_new new
+ def new(str = nil)
+ if str
+ orig_new.update(str)
+ else
+ orig_new
+ end
+ end
+
+ def sha1(*args)
new(*args)
end
end