Class: IO::Console::Mode
Do not use. This class is for internal use only.
| Relationships & Source Files | |
| Inherits: | Object |
| Defined in: | ext/io/console/console.c |
Instance Attribute Summary
- #echo (also: #echo?) rw
- #echo=(f) rw
-
#echo? ⇒ Boolean
rw
Alias for #echo.
- #min rw
- #min=(min) rw
- #time rw
- #time=(time) rw
-
#virtual_terminal_processing=(enabled)
rw
Enables or disables virtual terminal sequence processing in
mode. -
#virtual_terminal_processing? ⇒ Boolean
rw
Returns whether virtual terminal sequences are processed on output.
-
#wrap_at_eol_output=(enabled)
rw
Enables or disables wrapping at the end of a line in
mode. -
#wrap_at_eol_output? ⇒ Boolean
rw
Returns whether output wraps at the end of a line.
Instance Method Summary
Instance Attribute Details
#echo (rw) Also known as: #echo?
[ GitHub ]# File 'ext/io/console/console.c', line 779
static VALUE
conmode_get_echo(VALUE obj)
{
conmode *t = rb_check_typeddata(obj, &conmode_type);
return echo_p(t) ? Qtrue : Qfalse;
}
#echo=(f) (rw)
[ GitHub ]# File 'ext/io/console/console.c', line 786
static VALUE
conmode_set_echo(VALUE obj, VALUE f)
{
conmode *t = rb_check_typeddata(obj, &conmode_type);
if (RTEST(f))
set_echo(t, NULL);
else
set_noecho(t, NULL);
return obj;
}
#echo? ⇒ Boolean (rw)
Alias for #echo.
#min (rw)
[ GitHub ]# File 'ext/io/console/console.c', line 818
static VALUE
conmode_get_min(VALUE obj)
{
conmode *t = rb_check_typeddata(obj, &conmode_type);
#ifdef VMIN
return INT2FIX(t->c_cc[VMIN]);
#else
(void)t;
return Qnil;
#endif
}
#min=(min) (rw)
[ GitHub ]# File 'ext/io/console/console.c', line 830
static VALUE
conmode_set_min(VALUE obj, VALUE min)
{
conmode *t = rb_check_typeddata(obj, &conmode_type);
int vmin = NIL_P(min) ? 1 : clamp_uchar(NUM2INT(min));
#ifdef VMIN
t->c_cc[VMIN] = vmin;
#else
(void)t;
(void)vmin;
#endif
return min;
}
#time (rw)
[ GitHub ]# File 'ext/io/console/console.c', line 844
static VALUE
conmode_get_time(VALUE obj)
{
conmode *t = rb_check_typeddata(obj, &conmode_type);
#ifdef VTIME
return rb_rational_new(INT2FIX(t->c_cc[VTIME]), INT2FIX(10));
#else
(void)t;
return Qnil;
#endif
}
#time=(time) (rw)
[ GitHub ]# File 'ext/io/console/console.c', line 856
static VALUE
conmode_set_time(VALUE obj, VALUE time)
{
conmode *t = rb_check_typeddata(obj, &conmode_type);
int vtime = NIL_P(time) ? 0 : clamp_uchar(to_vtime(time));
#ifdef VTIME
t->c_cc[VTIME] = vtime;
#else
(void)t;
(void)vtime;
#endif
return time;
}
#virtual_terminal_processing=(enabled) (rw)
Enables or disables virtual terminal sequence processing in mode.
Assign mode to IO#console_mode= to apply the change.
# File 'ext/io/console/console.c', line 891
static VALUE
conmode_set_virtual_terminal_processing(VALUE obj, VALUE enabled)
{
conmode *t = rb_check_typeddata(obj, &conmode_type);
if (RTEST(enabled))
*t |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
else
*t &= ~ENABLE_VIRTUAL_TERMINAL_PROCESSING;
return obj;
}
#virtual_terminal_processing? ⇒ Boolean (rw)
Returns whether virtual terminal sequences are processed on output.
# File 'ext/io/console/console.c', line 877
static VALUE
conmode_virtual_terminal_processing_p(VALUE obj)
{
conmode *t = rb_check_typeddata(obj, &conmode_type);
return (*t & ENABLE_VIRTUAL_TERMINAL_PROCESSING) ? Qtrue : Qfalse;
}
#wrap_at_eol_output=(enabled) (rw)
Enables or disables wrapping at the end of a line in mode.
Assign mode to IO#console_mode= to apply the change.
# File 'ext/io/console/console.c', line 922
static VALUE
conmode_set_wrap_at_eol_output(VALUE obj, VALUE enabled)
{
conmode *t = rb_check_typeddata(obj, &conmode_type);
if (RTEST(enabled))
*t |= ENABLE_WRAP_AT_EOL_OUTPUT;
else
*t &= ~ENABLE_WRAP_AT_EOL_OUTPUT;
return obj;
}
#wrap_at_eol_output? ⇒ Boolean (rw)
Returns whether output wraps at the end of a line.
# File 'ext/io/console/console.c', line 908
static VALUE
conmode_wrap_at_eol_output_p(VALUE obj)
{
conmode *t = rb_check_typeddata(obj, &conmode_type);
return (*t & ENABLE_WRAP_AT_EOL_OUTPUT) ? Qtrue : Qfalse;
}
Instance Method Details
#initialize_copy(obj2)
[ GitHub ]# File 'ext/io/console/console.c', line 770
static VALUE
conmode_init_copy(VALUE obj, VALUE obj2)
{
conmode *t = rb_check_typeddata(obj, &conmode_type);
conmode *t2 = rb_check_typeddata(obj2, &conmode_type);
*t = *t2;
return obj;
}
#raw(*args)
[ GitHub ]# File 'ext/io/console/console.c', line 807
static VALUE
conmode_raw_new(int argc, VALUE *argv, VALUE obj)
{
conmode *r = rb_check_typeddata(obj, &conmode_type);
conmode t = *r;
rawmode_arg_t opts, *optp = rawmode_opt(&argc, argv, 0, 0, &opts);
set_rawmode(&t, optp);
return conmode_new(rb_obj_class(obj), &t);
}
#raw!(*args)
[ GitHub ]# File 'ext/io/console/console.c', line 797
static VALUE
conmode_set_raw(int argc, VALUE *argv, VALUE obj)
{
conmode *t = rb_check_typeddata(obj, &conmode_type);
rawmode_arg_t opts, *optp = rawmode_opt(&argc, argv, 0, 0, &opts);
set_rawmode(t, optp);
return obj;
}