cheatsheets/ruby.md

30 lines
1.7 KiB
Markdown
Raw Permalink Normal View History

2013-10-14 02:36:58 +00:00
---
title: Ruby
2015-11-24 05:02:17 +00:00
category: Ruby
tags: [WIP]
intro: |
Quick reference to some features of the Ruby programming language.
2013-10-14 02:36:58 +00:00
---
2012-07-03 08:09:36 +00:00
### Reference
{:.-one-column}
| Code | Description |
| ----------------------- | --------------------------------------------------------- |
| `$!` | latest error message |
| `$@` | location of error |
| `$_` | string last read by gets |
| `$.` | line number last read by interpreter |
| `$&` | string last matched by regexp |
| `$~` | the last regexp match, as an array of subexpressions |
| `$n` | the nth subexpression in the last match (same as `$~[n]`) |
| `$=` | case-insensitivity flag |
| `$/` | input record separator |
| `$\` | output record separator |
| `$0` | the name of the ruby script file |
| `$*` (or `ARGV`) | the command line arguments |
| `$$` | interpreter's process ID |
| `$?` | exit status of last executed child process |
| `$-i` `$-l` `$-p` `$-v` | Command line switches |
| `$-v` (or `$VERBOSE`) | verbose mode |