@@ -898,6 +898,16 @@ console_set_winsize(VALUE io, VALUE size)
898
898
#endif
899
899
900
900
#ifdef _WIN32
901
+ /*
902
+ * call-seq:
903
+ * io.check_winsize_changed { ... } -> io
904
+ *
905
+ * Yields while console input events are queued.
906
+ *
907
+ * This method is Windows only.
908
+ *
909
+ * You must require 'io/console' to use this method.
910
+ */
901
911
static VALUE
902
912
console_check_winsize_changed (VALUE io )
903
913
{
@@ -984,6 +994,14 @@ console_ioflush(VALUE io)
984
994
return io ;
985
995
}
986
996
997
+ /*
998
+ * call-seq:
999
+ * io.beep
1000
+ *
1001
+ * Beeps on the output console.
1002
+ *
1003
+ * You must require 'io/console' to use this method.
1004
+ */
987
1005
static VALUE
988
1006
console_beep (VALUE io )
989
1007
{
@@ -1051,6 +1069,17 @@ console_scroll(VALUE io, int line)
1051
1069
1052
1070
#include "win32_vk.inc"
1053
1071
1072
+ /*
1073
+ * call-seq:
1074
+ * io.pressed?(key) -> bool
1075
+ *
1076
+ * Returns +true+ if +key+ is pressed. +key+ may be a virtual key
1077
+ * code or its name (String or Symbol) with out "VK_" prefix.
1078
+ *
1079
+ * This method is Windows only.
1080
+ *
1081
+ * You must require 'io/console' to use this method.
1082
+ */
1054
1083
static VALUE
1055
1084
console_key_pressed_p (VALUE io , VALUE k )
1056
1085
{
@@ -1194,6 +1223,14 @@ console_cursor_pos(VALUE io)
1194
1223
#endif
1195
1224
}
1196
1225
1226
+ /*
1227
+ * call-seq:
1228
+ * io.goto(line, column) -> io
1229
+ *
1230
+ * Set the cursor position at +line+ and +column+.
1231
+ *
1232
+ * You must require 'io/console' to use this method.
1233
+ */
1197
1234
static VALUE
1198
1235
console_goto (VALUE io , VALUE y , VALUE x )
1199
1236
{
@@ -1240,6 +1277,15 @@ console_move(VALUE io, int y, int x)
1240
1277
return io ;
1241
1278
}
1242
1279
1280
+ /*
1281
+ * call-seq:
1282
+ * io.goto_column(column) -> io
1283
+ *
1284
+ * Set the cursor position at +column+ in the same line of the current
1285
+ * position.
1286
+ *
1287
+ * You must require 'io/console' to use this method.
1288
+ */
1243
1289
static VALUE
1244
1290
console_goto_column (VALUE io , VALUE val )
1245
1291
{
@@ -1262,6 +1308,18 @@ console_goto_column(VALUE io, VALUE val)
1262
1308
return io ;
1263
1309
}
1264
1310
1311
+ /*
1312
+ * call-seq:
1313
+ * io.erase_line(mode) -> io
1314
+ *
1315
+ * Erases the line at the cursor corresponding to +mode+.
1316
+ * +mode+ may be either:
1317
+ * 0: after cursor
1318
+ * 1: before and cursor
1319
+ * 2: entire line
1320
+ *
1321
+ * You must require 'io/console' to use this method.
1322
+ */
1265
1323
static VALUE
1266
1324
console_erase_line (VALUE io , VALUE val )
1267
1325
{
@@ -1297,6 +1355,18 @@ console_erase_line(VALUE io, VALUE val)
1297
1355
return io ;
1298
1356
}
1299
1357
1358
+ /*
1359
+ * call-seq:
1360
+ * io.erase_screen(mode) -> io
1361
+ *
1362
+ * Erases the screen at the cursor corresponding to +mode+.
1363
+ * +mode+ may be either:
1364
+ * 0: after cursor
1365
+ * 1: before and cursor
1366
+ * 2: entire screen
1367
+ *
1368
+ * You must require 'io/console' to use this method.
1369
+ */
1300
1370
static VALUE
1301
1371
console_erase_screen (VALUE io , VALUE val )
1302
1372
{
@@ -1339,6 +1409,16 @@ console_erase_screen(VALUE io, VALUE val)
1339
1409
return io ;
1340
1410
}
1341
1411
1412
+ /*
1413
+ * call-seq:
1414
+ * io.cursor = [line, column] -> io
1415
+ *
1416
+ * Same as <tt>io.goto(line, column)</tt>
1417
+ *
1418
+ * See IO#goto.
1419
+ *
1420
+ * You must require 'io/console' to use this method.
1421
+ */
1342
1422
static VALUE
1343
1423
console_cursor_set (VALUE io , VALUE cpos )
1344
1424
{
@@ -1347,42 +1427,98 @@ console_cursor_set(VALUE io, VALUE cpos)
1347
1427
return console_goto (io , RARRAY_AREF (cpos , 0 ), RARRAY_AREF (cpos , 1 ));
1348
1428
}
1349
1429
1430
+ /*
1431
+ * call-seq:
1432
+ * io.cursor_up(n) -> io
1433
+ *
1434
+ * Moves the cursor up +n+ lines.
1435
+ *
1436
+ * You must require 'io/console' to use this method.
1437
+ */
1350
1438
static VALUE
1351
1439
console_cursor_up (VALUE io , VALUE val )
1352
1440
{
1353
1441
return console_move (io , - NUM2INT (val ), 0 );
1354
1442
}
1355
1443
1444
+ /*
1445
+ * call-seq:
1446
+ * io.cursor_down(n) -> io
1447
+ *
1448
+ * Moves the cursor down +n+ lines.
1449
+ *
1450
+ * You must require 'io/console' to use this method.
1451
+ */
1356
1452
static VALUE
1357
1453
console_cursor_down (VALUE io , VALUE val )
1358
1454
{
1359
1455
return console_move (io , + NUM2INT (val ), 0 );
1360
1456
}
1361
1457
1458
+ /*
1459
+ * call-seq:
1460
+ * io.cursor_left(n) -> io
1461
+ *
1462
+ * Moves the cursor left +n+ columns.
1463
+ *
1464
+ * You must require 'io/console' to use this method.
1465
+ */
1362
1466
static VALUE
1363
1467
console_cursor_left (VALUE io , VALUE val )
1364
1468
{
1365
1469
return console_move (io , 0 , - NUM2INT (val ));
1366
1470
}
1367
1471
1472
+ /*
1473
+ * call-seq:
1474
+ * io.cursor_right(n) -> io
1475
+ *
1476
+ * Moves the cursor right +n+ columns.
1477
+ *
1478
+ * You must require 'io/console' to use this method.
1479
+ */
1368
1480
static VALUE
1369
1481
console_cursor_right (VALUE io , VALUE val )
1370
1482
{
1371
1483
return console_move (io , 0 , + NUM2INT (val ));
1372
1484
}
1373
1485
1486
+ /*
1487
+ * call-seq:
1488
+ * io.scroll_forward(n) -> io
1489
+ *
1490
+ * Scrolls the entire scrolls forward +n+ lines.
1491
+ *
1492
+ * You must require 'io/console' to use this method.
1493
+ */
1374
1494
static VALUE
1375
1495
console_scroll_forward (VALUE io , VALUE val )
1376
1496
{
1377
1497
return console_scroll (io , + NUM2INT (val ));
1378
1498
}
1379
1499
1500
+ /*
1501
+ * call-seq:
1502
+ * io.scroll_backward(n) -> io
1503
+ *
1504
+ * Scrolls the entire scrolls backward +n+ lines.
1505
+ *
1506
+ * You must require 'io/console' to use this method.
1507
+ */
1380
1508
static VALUE
1381
1509
console_scroll_backward (VALUE io , VALUE val )
1382
1510
{
1383
1511
return console_scroll (io , - NUM2INT (val ));
1384
1512
}
1385
1513
1514
+ /*
1515
+ * call-seq:
1516
+ * io.clear_screen -> io
1517
+ *
1518
+ * Clears the entire screen and moves the cursor top-left corner.
1519
+ *
1520
+ * You must require 'io/console' to use this method.
1521
+ */
1386
1522
static VALUE
1387
1523
console_clear_screen (VALUE io )
1388
1524
{
@@ -1677,7 +1813,9 @@ InitVM_console(void)
1677
1813
rb_define_method (rb_cIO , "getpass" , console_getpass , -1 );
1678
1814
rb_define_singleton_method (rb_cIO , "console" , console_dev , -1 );
1679
1815
{
1816
+ /* :stopdoc: */
1680
1817
VALUE mReadable = rb_define_module_under (rb_cIO , "generic_readable" );
1818
+ /* :startdoc: */
1681
1819
rb_define_method (mReadable , "getch" , io_getch , -1 );
1682
1820
rb_define_method (mReadable , "getpass" , io_getpass , -1 );
1683
1821
}
0 commit comments