1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* encoding.c (rb_obj_encoding): returns encoding of the given object.

* re.c (Init_Regexp): new method Regexp#encoding.

* string.c (str_encoding): moved to encoding.c


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13613 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2007-10-04 06:57:19 +00:00
parent 612b2ed6a7
commit 19dee8af57
5 changed files with 26 additions and 16 deletions

View file

@ -259,6 +259,20 @@ rb_enc_copy(VALUE obj1, VALUE obj2)
}
/*
* call-seq:
* obj.encoding => str
*
* Retruns the encoding name.
*/
VALUE
rb_obj_encoding(VALUE obj)
{
return rb_str_new2(rb_enc_name(rb_enc_get(obj)));
}
char*
rb_enc_nth(const char *p, const char *e, int nth, rb_encoding *enc)
{