code
ref
Cheat Sheets
Quick Reference
JSON Formatter
Learn
Tools
Browser Support
Search…
Ctrl K
Cheat Sheets
/
Languages
/
Ruby
Ruby
Ruby 3.4 core classes — String, Array, Hash, Enumerable, Kernel — and syntax guides.
Official reference ↗
String
capitalize
center
chars
chomp
chop
count
delete
downcase
each_char
empty?
end_with?
gsub
include?
index
length
ljust
lines
match
replace
reverse
rjust
scan
slice
split
squeeze
start_with?
strip
sub
swapcase
to_i
to_f
to_sym
tr
upcase
+
*
%
=~
Array
Add & Remove
push
<<
pop
shift
unshift
insert
concat
delete
delete_at
delete_if
compact
clear
fill
Query & Transform
[]
first
last
take
drop
slice
dig
include?
index
count
sample
shuffle
sort
reverse
rotate
flatten
uniq
zip
product
join
sum
min
max
map
select
reject
any?
all?
none?
each
each_with_index
Hash
[]
[]=
fetch
dig
store
delete
key?
value?
keys
values
each
each_pair
merge
select
reject
filter_map
transform_keys
transform_values
to_a
invert
slice
except
compact
empty?
size
any?
default
group_by
Enumerable
map
flat_map
filter_map
select
reject
find
find_index
reduce
inject
each_with_index
each_with_object
each_slice
each_cons
group_by
partition
chunk_while
sort_by
min_by
max_by
minmax
sum
count
tally
zip
include?
first
take_while
drop_while
uniq
to_h
lazy
Integer & Range
Integer
times
upto
downto
even?
odd?
zero?
abs
digits
gcd
lcm
pow
to_s
round
floor
ceil
Range
each
step
include?
cover?
to_a
sum
min
max
size
Kernel
puts
print
p
pp
gets
require
require_relative
raise
loop
rand
sleep
format
sprintf
lambda
proc
catch
throw
caller
exit
at_exit
Integer
Float
String
Array
Object
tap
then
freeze
frozen?
dup
clone
respond_to?
is_a?
kind_of?
instance_of?
nil?
send
public_send
method
methods
instance_variable_get
instance_variables
define_singleton_method
inspect
to_s
itself
Files & IO
File
File.exist?
File.directory?
File.file?
File.basename
File.dirname
File.extname
File.join
File.expand_path
File.size
File.delete
File.rename
File.open
IO
IO.read
IO.readlines
IO.write
IO.foreach
Dir
Dir.glob
Dir.entries
Dir.children
Dir.mkdir
Dir.pwd
Dir.exist?
Other Classes
Symbol
Proc
Method
Struct
Data
Comparable
Time
Regexp
MatchData
Set
Exception
StandardError
Fiber
Thread
Ractor
ObjectSpace
GC
Syntax
Literals
Assignment
Control expressions
Methods
Calling methods
Modules & classes
Exceptions
Pattern matching
Precedence
Refinements
Miscellaneous
Tooling
irb
gem
bundler
rake
rdoc
Ruby Style Guide