$@ Array of backtrace -d Debug $& String of last match -e One Line $` String left of last match -h Help $‘ Str right of last match -n gets loop Types Expressions Variables $+ Last group of last match -rL require L 12345 if expr [then] local $N Nth group of last match -v verbose elsif expr 123.45 @instance $~ Info about last match -w warnings [then] 1.23e-4 else @@class $= Case insensitive flag -y comp debug 0xFF00 end CONSTANT $/ Input record separator 0b01100 unless expr $\ Output record separator Reserved Words [then] 1..5 else Operators and $, Output field separator alias end Precedence 1...5 $. Line number of last file and expr if expr :: ‚a‘..‘z‘ $> Default output BEGIN expr unless [] ‚a‘...‘z‘ $_ Last input line of string expr begin ** ‚string sq‘ $* Command line args case expr break + - ! ~ „string dq“ when comp $0 Name of script case else * / % „#{expr}“ $$ Process number end class << >> „\t\r\n“ $“ Module names loaded while expr [do] def & %q(string sq) end $stderr Standard error output defined? | ^ %Q(string dq) until expr [do] $stdin Standard input do end > >= < <= %(string dq) $stdout Standard output else do <=> == === != <<id string id while expr =~ elsif :symbol Regex do && END /regex/opt until expr . all characters .. ... end %r|regex| for var in expr [ ] any single char in set = ( += -= ) ensure [1, 2, 3] [do] [^ ] any single char not in set not false end %w(1 2 3) * zero or more and or for expr.each [do] %W(1 2 #{expr}) end + one or more if {1=>2, :s=>‘v‘} break next redo ? zero or one Constants in retry | alteration __FILE__ module Exceptions ( ) Group next __LINE__ begin Module/Class ^ Beginning of line or str nil rescue ex => ENV module Name $ End of line or string not var ARGF end else {1,5} 1 to 5 or class Name ARGV ensure end \A Beginning of a string redo end class Name < \b Word boundary rescue StandardError Sup \B Non-word boundary retry ZeroDivisi- end onError \d digit, same as [0..9] return class << obj RangeError \D Non-digit self end SecurityError \s Whitespace super def IOError name(args...) \S Non-whitespace then end IndexError \w Word-character true def inst. RuntimeError \W Non-word-character undef name(...) end \z End of a string unless public \Z End of string, before nl until protected when private while attr_reader attr_writer yield attr attr_accessor alias new old Object Array File Obj#class -> class Array::new (int [,obj]) -> array File#new (path, modestring)-> file Obj#freeze -> object Array#clear File#new (path, modestring) do |file| ... end Obj#frozen? -> true or false Array#map! do |x| ... end File#open (path, modestring) do Obj#inspect -> string Array#delete (value) -> obj or nil |file| ... end Obj#is_a? (class) -> true or false Array#delete_at (index)-> obj or n File#exist? (path) -> t or f Obj#methods -> array Array#delete_if do |x| ... end File#basename (path [,suffix]) -> Obj#respond_to? (sym) -> true or Array#each do |x| ... end string false Array#flatten! -> array File#delete (path, ...) Obj#to_s -> string Array#include? (value) -> t or f File#rename (old, new) Array#insert (idx, obj...)-> array File#size (path) -> integer String Array#join ([string]) -> string r Read-only, from beginning Str#[num, num/range/regx] -> str Array#length -> integer r+ Read-write, from beginning Str#capitalize! -> string Array#pop -> obj or nil w Write-only, trunc. / new Str#center (int [,str]) -> str Array#push (obj...) -> array w+ Read-write, trunc. / new Str#chomp! ([str]) -> str a Write-only, from end / new Str#count -> integer Hash a+ Read-write, from end / new Str#delete! ([string]) -> string Hash#clear b Binary (Windows only) Str#downcase! -> string Hash#delete (key) -> obj or nil Str#each ([str]) do |str| ... end Hash#delete_if do |k, v| ... end Dir Str#each_line do |line| ... end Hash#each do |k, v| ... end Dir[string] -> array Str#gsub! (rgx) do |match| ... end Hash#has_key? (k) -> true or false Dir::chdir ([string]) Str#include? (str) -> true / false Hash#has_value? (v) -> t or f Dir::delete (string) Str#index (str/reg [,off]) -> int Hash#index (value) -> key Dir::entries (string) -> array Str#insert (int, string) -> string Hash#keys -> array Dir::foreach (string) do |file| Str#length -> integer ... end Hash#length -> integer Str#ljust (int [,padstr]) -> str Dir::getwd -> string Hash#select do |k, v| ... end -> Str#rindex (str/reg [,off]) -> int array Dir::mkdir (string) Str#rjust (int [,padstr]) -> str Hash#values -> array Dir::new (string) Str#scan (rgx) do |match| ... end Dir::open (string) do |dir| .. end Str#split (string) -> array Test::Unit Dir#close Str#strip! -> string assert (boolean [,msg]) Dir#pos -> integer Str#sub! (rgx) do |match| ... end assert_block (message) do ... end Dir#read -> string or nil Str#swapcase! -> string assert_equal (expected, actual Dir#rewind Str#to_sym -> symbol [,msg])