OSDN Git Service

Regular updates
[twpd/master.git] / ruby.md
1 ---
2 title: Ruby
3 category: Ruby
4 tags: [WIP]
5 layout: 2017/sheet
6 intro: |
7   Quick reference to some features of the Ruby programming language.
8 ---
9
10 ### Reference
11
12 {:.-one-column}
13
14 | Code                    | Description                                               |
15 | ----------------------- | --------------------------------------------------------- |
16 | `$!`                    | latest error message                                      |
17 | `$@`                    | location of error                                         |
18 | `$_`                    | string last read by gets                                  |
19 | `$.`                    | line number last read by interpreter                      |
20 | `$&`                    | string last matched by regexp                             |
21 | `$~`                    | the last regexp match, as an array of subexpressions      |
22 | `$n`                    | the nth subexpression in the last match (same as `$~[n]`) |
23 | `$=`                    | case-insensitivity flag                                   |
24 | `$/`                    | input record separator                                    |
25 | `$\`                    | output record separator                                   |
26 | `$0`                    | the name of the ruby script file                          |
27 | `$*` (or `ARGV`)        | the command line arguments                                |
28 | `$$`                    | interpreter's process ID                                  |
29 | `$?`                    | exit status of last executed child process                |
30 | `$-i` `$-l` `$-p` `$-v` | Command line switches                                     |
31 | `$-v` (or `$VERBOSE`)   | verbose mode                                              |