Skip to content

Commit 44dce34

Browse files
committed
[DOC] Add missing documents
1 parent 4346058 commit 44dce34

File tree

3 files changed

+143
-0
lines changed

3 files changed

+143
-0
lines changed

.document

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
LICENSE.txt
22
README.md
3+
docs/
34
ext/
45
lib/io/console/size.rb

docs/io.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# :stopdoc:
2+
class IO
3+
end
4+
# :startdoc:

ext/io/console/console.c

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,16 @@ console_set_winsize(VALUE io, VALUE size)
898898
#endif
899899

900900
#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+
*/
901911
static VALUE
902912
console_check_winsize_changed(VALUE io)
903913
{
@@ -984,6 +994,14 @@ console_ioflush(VALUE io)
984994
return io;
985995
}
986996

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+
*/
9871005
static VALUE
9881006
console_beep(VALUE io)
9891007
{
@@ -1051,6 +1069,17 @@ console_scroll(VALUE io, int line)
10511069

10521070
#include "win32_vk.inc"
10531071

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+
*/
10541083
static VALUE
10551084
console_key_pressed_p(VALUE io, VALUE k)
10561085
{
@@ -1194,6 +1223,14 @@ console_cursor_pos(VALUE io)
11941223
#endif
11951224
}
11961225

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+
*/
11971234
static VALUE
11981235
console_goto(VALUE io, VALUE y, VALUE x)
11991236
{
@@ -1240,6 +1277,15 @@ console_move(VALUE io, int y, int x)
12401277
return io;
12411278
}
12421279

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+
*/
12431289
static VALUE
12441290
console_goto_column(VALUE io, VALUE val)
12451291
{
@@ -1262,6 +1308,18 @@ console_goto_column(VALUE io, VALUE val)
12621308
return io;
12631309
}
12641310

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+
*/
12651323
static VALUE
12661324
console_erase_line(VALUE io, VALUE val)
12671325
{
@@ -1297,6 +1355,18 @@ console_erase_line(VALUE io, VALUE val)
12971355
return io;
12981356
}
12991357

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+
*/
13001370
static VALUE
13011371
console_erase_screen(VALUE io, VALUE val)
13021372
{
@@ -1339,6 +1409,16 @@ console_erase_screen(VALUE io, VALUE val)
13391409
return io;
13401410
}
13411411

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+
*/
13421422
static VALUE
13431423
console_cursor_set(VALUE io, VALUE cpos)
13441424
{
@@ -1347,42 +1427,98 @@ console_cursor_set(VALUE io, VALUE cpos)
13471427
return console_goto(io, RARRAY_AREF(cpos, 0), RARRAY_AREF(cpos, 1));
13481428
}
13491429

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+
*/
13501438
static VALUE
13511439
console_cursor_up(VALUE io, VALUE val)
13521440
{
13531441
return console_move(io, -NUM2INT(val), 0);
13541442
}
13551443

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+
*/
13561452
static VALUE
13571453
console_cursor_down(VALUE io, VALUE val)
13581454
{
13591455
return console_move(io, +NUM2INT(val), 0);
13601456
}
13611457

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+
*/
13621466
static VALUE
13631467
console_cursor_left(VALUE io, VALUE val)
13641468
{
13651469
return console_move(io, 0, -NUM2INT(val));
13661470
}
13671471

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+
*/
13681480
static VALUE
13691481
console_cursor_right(VALUE io, VALUE val)
13701482
{
13711483
return console_move(io, 0, +NUM2INT(val));
13721484
}
13731485

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+
*/
13741494
static VALUE
13751495
console_scroll_forward(VALUE io, VALUE val)
13761496
{
13771497
return console_scroll(io, +NUM2INT(val));
13781498
}
13791499

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+
*/
13801508
static VALUE
13811509
console_scroll_backward(VALUE io, VALUE val)
13821510
{
13831511
return console_scroll(io, -NUM2INT(val));
13841512
}
13851513

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+
*/
13861522
static VALUE
13871523
console_clear_screen(VALUE io)
13881524
{
@@ -1677,7 +1813,9 @@ InitVM_console(void)
16771813
rb_define_method(rb_cIO, "getpass", console_getpass, -1);
16781814
rb_define_singleton_method(rb_cIO, "console", console_dev, -1);
16791815
{
1816+
/* :stopdoc: */
16801817
VALUE mReadable = rb_define_module_under(rb_cIO, "generic_readable");
1818+
/* :startdoc: */
16811819
rb_define_method(mReadable, "getch", io_getch, -1);
16821820
rb_define_method(mReadable, "getpass", io_getpass, -1);
16831821
}

0 commit comments

Comments
 (0)