[ruby/io-console] Pre-define chomp! ID
https://github.com/ruby/io-console/commit/028e1c9497
This commit is contained in:
parent
ead8d89bd7
commit
4272395982
@ -77,7 +77,7 @@ getattr(int fd, conmode *t)
|
|||||||
|
|
||||||
static ID id_getc, id_console, id_close, id_min, id_time, id_intr;
|
static ID id_getc, id_console, id_close, id_min, id_time, id_intr;
|
||||||
#if ENABLE_IO_GETPASS
|
#if ENABLE_IO_GETPASS
|
||||||
static ID id_gets;
|
static ID id_gets, id_chomp_bang;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_RB_SCHEDULER_TIMEOUT
|
#ifdef HAVE_RB_SCHEDULER_TIMEOUT
|
||||||
@ -1562,7 +1562,7 @@ static VALUE
|
|||||||
str_chomp(VALUE str)
|
str_chomp(VALUE str)
|
||||||
{
|
{
|
||||||
if (!NIL_P(str)) {
|
if (!NIL_P(str)) {
|
||||||
rb_funcallv(str, rb_intern("chomp!"), 0, 0);
|
rb_funcallv(str, id_chomp_bang, 0, 0);
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
@ -1622,6 +1622,7 @@ Init_console(void)
|
|||||||
id_getc = rb_intern("getc");
|
id_getc = rb_intern("getc");
|
||||||
#if ENABLE_IO_GETPASS
|
#if ENABLE_IO_GETPASS
|
||||||
id_gets = rb_intern("gets");
|
id_gets = rb_intern("gets");
|
||||||
|
id_chomp_bang = rb_intern("chomp!");
|
||||||
#endif
|
#endif
|
||||||
id_console = rb_intern("console");
|
id_console = rb_intern("console");
|
||||||
id_close = rb_intern("close");
|
id_close = rb_intern("close");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user