зеркало из https://github.com/github/ruby.git
* vm_method.c (rb_attr): should preserve encoding info.
[ruby-dev:38498] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23491 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
3465856922
Коммит
9553911f29
|
@ -1,3 +1,8 @@
|
|||
Wed May 20 00:05:52 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* vm_method.c (rb_attr): should preserve encoding info.
|
||||
[ruby-dev:38498]
|
||||
|
||||
Tue May 19 22:54:35 2009 Yusuke Endoh <mame@tsg.ne.jp>
|
||||
|
||||
* time.c (time_minus): always return a Float. [ruby-dev:38446]
|
||||
|
|
|
@ -446,6 +446,7 @@ rb_attr(VALUE klass, ID id, int read, int write, int ex)
|
|||
{
|
||||
const char *name;
|
||||
ID attriv;
|
||||
VALUE aname;
|
||||
int noex;
|
||||
|
||||
if (!ex) {
|
||||
|
@ -473,7 +474,9 @@ rb_attr(VALUE klass, ID id, int read, int write, int ex)
|
|||
if (!name) {
|
||||
rb_raise(rb_eArgError, "argument needs to be symbol or string");
|
||||
}
|
||||
attriv = rb_intern_str(rb_sprintf("@%s", name));
|
||||
aname = rb_sprintf("@%s", name);
|
||||
rb_enc_copy(aname, rb_id2str(id));
|
||||
attriv = rb_intern_str(aname);
|
||||
if (read) {
|
||||
rb_add_method(klass, id, NEW_IVAR(attriv), noex);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче