W3C
school
文档首页
HTML
CSS
Javascript
Python
jQuery
NodeJS
PHP
Java
MySQL
Express
More »
开关
Ruby 官方文档
Resource
Online
Official Website
Download
Ruby Cheatsheet [.pdf]
Ruby Language QuickRef [.pdf]
Related
Ruby on Rails
Ruby on Rails Cheat Sheet
Array
Array
::[]
::new
::try_convert
#-
#[]
#[]=
#*
#&
#<<
#<=>
#+
#==
#|
#assoc
#at
#clear
#collect
#collect!
#combination
#compact
#compact!
#concat
#count
#cycle
#delete
#delete_at
#delete_if
#drop
#drop_while
#each
#each_index
#empty?
#eql?
#fetch
#fill
#find_index
#first
#flatten
#flatten!
#frozen?
#hash
#include?
#index
#initialize_copy
#insert
#inspect
#join
#keep_if
#last
#length
#map
#map!
#pack
#permutation
#pop
#product
#push
#rassoc
#reject
#reject!
#repeated_combination
#repeated_permutation
#replace
#reverse
#reverse_each
#reverse!
#rindex
#rotate
#rotate!
#sample
#select
#select!
#shift
#shuffle
#shuffle!
#size
#slice
#slice!
#sort
#sort_by!
#sort!
#take
#take_while
#to_a
#to_ary
#to_s
#transpose
#uniq
#uniq!
#unshift
#values_at
#zip
File
File
::absolute_path
::atime
::basename
::blockdev?
::chardev?
::chmod
::chown
::ctime
::delete
::directory?
::dirname
::executable_real?
::executable?
::exist?
::exists?
::expand_path
::extname
::file?
::fnmatch
::fnmatch?
::ftype
::grpowned?
::identical?
::join
::lchmod
::lchown
::link
::lstat
::mtime
::open
::owned?
::path
::pipe?
::readable_real?
::readable?
::readlink
::realdirpath
::realpath
::rename
::setgid?
::setuid?
::size
::size?
::socket?
::split
::stat
::sticky?
::symlink
::symlink?
::truncate
::umask
::unlink
::utime
::world_readable?
::world_writable?
::writable_real?
::writable?
::zero?
#atime
#chmod
#chown
#ctime
#flock
#lstat
#mtime
#path
#to_path
#truncate
String
String
#%
#===
#=~
#ascii_only?
#bytes
#bytesize
#byteslice
#capitalize
#capitalize!
#casecmp
#center
#chars
#chomp
#chomp!
#chop
#chop!
#chr
#codepoints
#crypt
#delete!
#downcase
#downcase!
#dump
#each_byte
#each_char
#each_codepoint
#each_line
#encode
#encode!
#encoding
#end_with?
#force_encoding
#getbyte
#gsub
#gsub!
#hex
#intern
#lines
#ljust
#lstrip
#lstrip!
#match
#next
#next!
#oct
#ord
#partition
#prepend
#rjust
#rpartition
#rstrip
#rstrip!
#scan
#setbyte
#split
#squeeze
#squeeze!
#start_with?
#strip
#strip!
#sub
#sub!
#succ
#succ!
#sum
#swapcase
#swapcase!
#to_c
#to_f
#to_i
#to_r
#to_str
#to_sym
#tr
#tr_s
#tr_s!
#tr!
#unpack
#upcase
#upcase!
#upto
#valid_encoding?
Math
Math
::acos
::acosh
::asin
::asinh
::atan
::atan2
::atanh
::cbrt
::cos
::cosh
::erf
::erfc
::exp
::frexp
::gamma
::hypot
::ldexp
::lgamma
::log
::log10
::log2
::sin
::sinh
::sqrt
::tan
::tanh
Integer
Integer
#ceil
#denominator
#downto
#even?
#floor
#gcd
#gcdlcm
#integer?
#lcm
#numerator
#odd?
#pred
#rationalize
#round
#times
#to_int
Numeric
Numeric
#-@
#+@
#abs
#abs2
#angle
#arg
#coerce
#conj
#conjugate
#div
#divmod
#fdiv
#i
#imag
#imaginary
#magnitude
#modulo
#nonzero?
#phase
#polar
#quo
#real
#real?
#rect
#rectangular
#remainder
#singleton_method_added
#step
#zero?
Object
Object
#!~
#class
#clone
#define_singleton_method
#display
#dup
#enum_for
#extend
#freeze
#instance_of?
#instance_variable_defined?
#instance_variable_get
#instance_variable_set
#instance_variables
#is_a?
#kind_of?
#method
#nil?
#object_id
#public_method
#public_send
#remove_instance_variable
#respond_to_missing?
#respond_to?
#send
#singleton_class
#singleton_methods
#taint
#tainted?
#tap
#to_enum
#trust
#untaint
#untrust
#untrusted?
Hash
Hash
#compare_by_identity
#compare_by_identity?
#default
#default_proc
#default_proc=
#default=
#each_key
#each_pair
#each_value
#has_key?
#has_value?
#invert
#key
#key?
#keys
#member?
#merge
#merge!
#rehash
#store
#to_hash
#update
#value?
#values
Regexp
Regexp
::compile
::escape
::last_match
::quote
::union
#~
#casefold?
#fixed_encoding?
#named_captures
#names
#options
#source
IO
Methods
::binread
::binwrite
::copy_stream
::for_fd
::foreach
::pipe
::popen
::read
::readlines
::select
::sysopen
::write
#advise
#autoclose?
#autoclose=
#binmode
#binmode?
#close
#close_on_exec?
#close_on_exec=
#close_read
#close_write
#closed?
#eof
#eof?
#external_encoding
#fcntl
#fdatasync
#fileno
#flush
#fsync
#getc
#gets
#internal_encoding
#ioctl
#isatty
#lineno
#lineno=
#pid
#pos
#pos=
#print
#printf
#putc
#puts
#read
#read_nonblock
#readbyte
#readchar
#readline
#readlines
#readpartial
#reopen
#rewind
#seek
#set_encoding
#stat
#sync
#sync=
#sysread
#sysseek
#syswrite
#tell
#to_io
#tty?
#ungetbyte
#ungetc
#write
#write_nonblock
Namespace
IO::WaitReadable
IO::WaitWritable
Time
Time
::_load
::at
::gm
::local
::mktime
::now
::utc
#_dump
#asctime
#day
#dst?
#friday?
#getgm
#getlocal
#getutc
#gmt_offset
#gmt?
#gmtime
#gmtoff
#hour
#isdst
#localtime
#marshal_dump
#marshal_load
#mday
#min
#mon
#monday?
#month
#nsec
#saturday?
#sec
#strftime
#subsec
#sunday?
#thursday?
#tuesday?
#tv_nsec
#tv_sec
#tv_usec
#usec
#utc
#utc_offset
#utc?
#wday
#wednesday?
#yday
#year
#zone
ARGF
ARGF
#argv
#file
#filename
#inplace_mode
#inplace_mode=
#skip
#to_write_io
BasicObject
BasicObject
#__id__
#__send__
#!
#!=
#equal?
#instance_eval
#instance_exec
#method_missing
#singleton_method_removed
#singleton_method_undefined
Bignum
Bignum
#^
#**
#/
#>
#>>
#>=
#<
#<=
Class
Class
#allocate
#inherited
#new
#superclass
Complex
Complex
::polar
::rect
::rectangular
Encoding
Methods
::aliases
::compatible?
::default_external
::default_external=
::default_internal
::default_internal=
::find
::list
::locale_charmap
::name_list
#ascii_compatible?
#dummy?
#name
#replicate
Namespace
Encoding::CompatibilityError
Encoding::Converter
Encoding::ConverterNotFoundError
Encoding::InvalidByteSequenceError
Encoding::UndefinedConversionError
Enumerator
Methods
#each_with_index
#each_with_object
#feed
#next_values
#peek
#peek_values
#with_index
#with_object
Namespace
Enumerator::Generator
Enumerator::Yielder
Exception
Exception
::exception
#backtrace
#exception
#message
#set_backtrace
Fiber
Fiber
::current
::yield
#alive?
#resume
#transfer
Float
Float
#finite?
#infinite?
#nan?
Fixnum
Fixnum
Kernel
Kernel
#`
#__callee__
#__method__
#abort
#Array
#at_exit
#autoload
#autoload?
#binding
#block_given?
#callcc
#caller
#catch
#Complex
#eval
#exec
#exit
#exit!
#fail
#Float
#fork
#format
#global_variables
#Integer
#iterator?
#lambda
#load
#local_variables
#loop
#open
#p
#proc
#raise
#rand
#Rational
#require
#require_relative
#set_trace_func
#sleep
#spawn
#sprintf
#srand
#String
#syscall
#system
#test
#throw
#trace_var
#trap
#untrace_var
#warn
Method
Method
#arity
#call
#owner
#parameters
#receiver
#source_location
#to_proc
#unbind
Module
Module
::constants
::nesting
#alias_method
#ancestors
#append_features
#attr
#attr_accessor
#attr_reader
#attr_writer
#class_eval
#class_exec
#class_variable_defined?
#class_variable_get
#class_variable_set
#class_variables
#const_defined?
#const_get
#const_missing
#const_set
#constants
#define_method
#extend_object
#extended
#include
#included
#included_modules
#instance_method
#instance_methods
#method_added
#method_defined?
#method_removed
#method_undefined
#module_eval
#module_exec
#module_function
#private
#private_class_method
#private_instance_methods
#private_method_defined?
#protected
#protected_instance_methods
#protected_method_defined?
#public
#public_class_method
#public_instance_method
#public_instance_methods
#public_method_defined?
#remove_class_variable
#remove_const
#remove_method
#undef_method
Proc
Proc
#curry
#lambda?
#yield
Process
Methods
::abort
::daemon
::detach
::egid
::egid=
::euid
::euid=
::exec
::exit
::exit!
::fork
::getpgid
::getpgrp
::getpriority
::getrlimit
::gid
::gid=
::groups
::groups=
::initgroups
::kill
::maxgroups
::maxgroups=
::pid
::ppid
::setpgid
::setpgrp
::setpriority
::setrlimit
::setsid
::spawn
::times
::uid
::uid=
::wait
::wait2
::waitall
::waitpid
::waitpid2
Namespace
Process::GID
Process::Status
Process::Sys
Process::UID
Random
Random
::new_seed
::rand
::srand
#seed
Range
Range
#begin
#cover?
#end
#exclude_end?
#max
Rational
Rational
Symbol
Symbol
::all_symbols
#id2name
Thread
Thread
::abort_on_exception
::abort_on_exception=
::DEBUG
::DEBUG=
::exclusive
::main
::pass
::start
::stop
#abort_on_exception
#abort_on_exception=
#add_trace_func
#group
#kill
#priority
#priority=
#run
#safe_level
#status
#stop?
#terminate
#value
#wakeup
Pre-defined
Variables
$`
The string to the left of the last successful match.
$_
The last input line of string by gets or readline.
$-0
The alias to $/
$-a
True if option -a is set. Read-only variable.
$-d
The alias to $DEBUG.
$-F
The alias to $;.
$-i
In in-place-edit mode, this variable holds the extention, otherwise nil.
$-l
True if option -l is set. Read-only variable.
$-p
True if option -p is set. Read-only variable.
$-v
The alias to $VERBOSE.
$,
The output field separator for the print and Array#join.
$;
The default separator for String#split.
$:
Load path for scripts and binary modules by load or require.
$!
The exception information message set by ‘raise’.
$?
The status of the last executed child process.
$.
The current input line number of the last file that was read.
$'
The string to the right of the last successful match.
$"
The array contains the module names loaded by require.
$@
Array of backtrace of the last exception thrown.
$*
Command line arguments given for the script sans args.
$/
The input record separator, newline by default.
$\
The output record separator for the print and IO#write. Default is nil.
$&
The string matched by the last successful pattern match in this scope.
$>
The default output for print, printf. $stdout by default.
$<
The virtual concatenation file of the files given on command line.
$+
The last bracket matched by the last successful match.
$=
The flag for case insensitive, nil by default.
$~
The information about the last match in the current scope.
$$
The process number of the Ruby running this script.
$0
Contains the name of the script being executed. May be assignable.
$1
The Nth group of the last successful match. May be > 1.
$DEBUG
The status of the -d switch.
$FILENAME
Current input file from $<. Same as $<.filename.
$LOAD_PATH
The alias to the $:.
$stderr
The current standard error output.
$stdin
The current standard input.
$stdout
The current standard output.
$VERBOSE
The verbose flag, which is set by the -v switch.
Global Constant
ARGV
The alias to the $*.
DATA
The file object of the script, pointing just after __END__.
ENV
The hash contains current environment variables.
FALSE
The false itself.
NIL
The nil itself.
RUBY_PLATFORM
The platform identifier
RUBY_RELEASE_DATE
The relase date string.
RUBY_VERSION
The ruby version string (VERSION was depricated).
STDERR
The standard error output. The default value for $stderr.
STDIN
The standard input. The default value for $stdin.
STDOUT
The standard output. The default value for $stdout.
TRUE
The typical true value.