Skip to content

Instantly share code, notes, and snippets.

@knwang
Last active August 29, 2015 14:27
Show Gist options
  • Save knwang/c7b1fbb7474b1b01ca46 to your computer and use it in GitHub Desktop.
Save knwang/c7b1fbb7474b1b01ca46 to your computer and use it in GitHub Desktop.

Array

::new
*
+
-
<=>
==
<<
|
&
[index]
[start, length]
[range]
[index]=
any?
at
collect {|item| ... }
collect! {|item| ...}
compact
compact!
concat(other_array)
count
delete(object)
delete_at(index)
delete_if {|item| ... }
drop(n)
drop_while {|item| ... }
each {|item| ... }
each_index {|index| ... }
empty?
find_index(object)
first
first(n)
flatten
flatten!
include?(object)
index(object)
insert(index, object)
join(separator)
keep_if {|item| ... }
last
last(n)
length
map {|item| ... }
map! {|item| ... }
pop
pop(n)
push
reject {|item| ... }
reject! {|item| ... }
reverse_each {|item| ... }
reverse
reverse!
rindex(object)
sample
select {|item| ... }
select! {|item| ... }
shift
shuffle
shuffle!
size
slice(index)
slice(start, length)
slice(range)
slice!(index)
slice!(start, length)
slice!(range)
sort
sort {|a, b| .. }
sort!
sort! {|a, b| .. }
sort_by {|item| .. }
take(n)
take_while {|item| ... }
uniq
uniq!
unshift(object)

Additional methods from Enumerable

all? {|item| ...}
any? {|item| ... }
detect {|item| ... }
group_by {|item| ...}
inject(initial, sym)
inject(sym)
inject {|accumulator, object| ... }
inject(intial) {|accumulator, object| ... }
reduce(initial, sym)
reduce(sym)
reduce {|accumulator, object| ... }
reduce(intial) {|accumulator, object| ... }
max
max {|item| ... }
max_by {|item| ... }
min
min {|item| ... }
min_by {|item| ... }
none? {|item| ... }
one? {|item| ... }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment