mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/digest/digest.c (Init_digest): Digest::Base.new() does no
longer take an initial string to feed. This change allows subclasses to take hashing parameters. A statement such as ``md = Digest::MD5.new(s)'' can be easily rewritten as ``md = Digest::MD5.new << s'' or ``md = Digest::MD5.new.update(s)''. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5cafaa6744
commit
f678390e1f
3 changed files with 11 additions and 14 deletions
|
@ -1,3 +1,12 @@
|
|||
Fri Oct 13 20:53:37 2006 Akinori MUSHA <knu@iDaemons.org>
|
||||
|
||||
* ext/digest/digest.c (Init_digest): Digest::Base.new() does no
|
||||
longer take an initial string to feed. This change allows
|
||||
subclasses to take hashing parameters. A statement such as
|
||||
``md = Digest::MD5.new(s)'' can be easily rewritten as
|
||||
``md = Digest::MD5.new << s'' or
|
||||
``md = Digest::MD5.new.update(s)''.
|
||||
|
||||
Fri Oct 13 20:51:55 2006 Akinori MUSHA <knu@iDaemons.org>
|
||||
|
||||
* ext/digest/digest.c, ext/digest/md5/md5init.c,
|
||||
|
|
|
@ -259,18 +259,6 @@ rb_digest_base_lshift(VALUE self, VALUE str)
|
|||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rb_digest_base_init(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
VALUE arg;
|
||||
|
||||
rb_scan_args(argc, argv, "01", &arg);
|
||||
|
||||
if (!NIL_P(arg)) rb_digest_base_update(self, arg);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* digest_obj.digest -> string
|
||||
|
@ -402,7 +390,6 @@ Init_digest(void)
|
|||
rb_define_singleton_method(cDigest_Base, "digest", rb_digest_base_s_digest, 1);
|
||||
rb_define_singleton_method(cDigest_Base, "hexdigest", rb_digest_base_s_hexdigest, 1);
|
||||
|
||||
rb_define_method(cDigest_Base, "initialize", rb_digest_base_init, -1);
|
||||
rb_define_method(cDigest_Base, "initialize_copy", rb_digest_base_copy, 1);
|
||||
rb_define_method(cDigest_Base, "reset", rb_digest_base_reset, 0);
|
||||
rb_define_method(cDigest_Base, "update", rb_digest_base_update, 1);
|
||||
|
|
|
@ -43,7 +43,8 @@ module TestDigest
|
|||
def test_eq
|
||||
# This test is also for clone()
|
||||
|
||||
md1 = self.class::ALGO.new("ABC")
|
||||
md1 = self.class::ALGO.new
|
||||
md1 << "ABC"
|
||||
|
||||
assert_equal(md1, md1.clone, self.class::ALGO)
|
||||
|
||||
|
|
Loading…
Reference in a new issue