mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/digest/digest.c (rb_digest_base_inspect): new method.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9bcbcb054a
commit
be02cb10f8
2 changed files with 26 additions and 0 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Thu Sep 14 08:30:02 2006 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* ext/digest/digest.c (rb_digest_base_inspect): new method.
|
||||||
|
|
||||||
Thu Sep 14 01:13:56 2006 NAKAMURA Usaku <usa@ruby-lang.org>
|
Thu Sep 14 01:13:56 2006 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
* gc.c (ruby_init_stack): decrease "stack level too deep" in Windows.
|
* gc.c (ruby_init_stack): decrease "stack level too deep" in Windows.
|
||||||
|
|
|
@ -191,6 +191,27 @@ rb_digest_base_hexdigest(VALUE self)
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
rb_digest_base_inspect(VALUE self)
|
||||||
|
{
|
||||||
|
algo_t *algo;
|
||||||
|
VALUE str;
|
||||||
|
char *cname;
|
||||||
|
|
||||||
|
algo = get_digest_base_metadata(rb_obj_class(self));
|
||||||
|
|
||||||
|
cname = rb_obj_classname(self);
|
||||||
|
|
||||||
|
/* #<Digest::Alg: xxxxx...xxxx> */
|
||||||
|
str = rb_str_buf_new(2 + strlen(cname) + 2 + algo->digest_len * 2 + 1);
|
||||||
|
rb_str_buf_cat2(str, "#<");
|
||||||
|
rb_str_buf_cat2(str, cname);
|
||||||
|
rb_str_buf_cat2(str, ": ");
|
||||||
|
rb_str_buf_append(str, rb_digest_base_hexdigest(self));
|
||||||
|
rb_str_buf_cat2(str, ">");
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
rb_digest_base_equal(VALUE self, VALUE other)
|
rb_digest_base_equal(VALUE self, VALUE other)
|
||||||
{
|
{
|
||||||
|
@ -261,6 +282,7 @@ Init_digest(void)
|
||||||
rb_define_method(cDigest_Base, "digest", rb_digest_base_digest, 0);
|
rb_define_method(cDigest_Base, "digest", rb_digest_base_digest, 0);
|
||||||
rb_define_method(cDigest_Base, "hexdigest", rb_digest_base_hexdigest, 0);
|
rb_define_method(cDigest_Base, "hexdigest", rb_digest_base_hexdigest, 0);
|
||||||
rb_define_method(cDigest_Base, "to_s", rb_digest_base_hexdigest, 0);
|
rb_define_method(cDigest_Base, "to_s", rb_digest_base_hexdigest, 0);
|
||||||
|
rb_define_method(cDigest_Base, "inspect", rb_digest_base_inspect, 0);
|
||||||
rb_define_method(cDigest_Base, "==", rb_digest_base_equal, 1);
|
rb_define_method(cDigest_Base, "==", rb_digest_base_equal, 1);
|
||||||
|
|
||||||
id_metadata = rb_intern("metadata");
|
id_metadata = rb_intern("metadata");
|
||||||
|
|
Loading…
Reference in a new issue