Enumerables Flashcards

1
Q

returns true self == object, false otherwise

A

include?, member?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

returns true if all elements meet a specified criterion, false otherwise

A

all?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

returns true if any element meets a specified criterion, false otherwise

A

any?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

returns the count of elements, based on an argument or block criterion, if given

A

count

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

returns a new hash containing the counts of each element

A

tally

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

return a specified number of leading elements

A

take

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

returns a specified number of trailing elements

A

drop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

returns the elements whose values are smallest among the element, as determined by <=> or a given block

A

min

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

returns the elements whose values are largest among the elements, as determined by<=> or a given block

A

max

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Returns a 2-element Array containing the smallest and largest elements.

A

minmax

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Returns the smallest element, as determined by the given block.

A

min_by

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Returns the largest element, as determined by the given block.

A

max_by

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Returns an element selected by the block. find, detect

A

find, detect

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Returns elements selected by the block.

A

find_all, filter, select

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Returns the index of an element selected by a given object or block

A

find_index

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Returns elements that are not duplicates.

A

uniq

17
Q

Returns the elements, sorted by <=> or the given block.

A

sort

18
Q

Returns the elements, sorted by the given block.

A

sort_by

19
Q

Returns objects returned by the block.

A

map, collect

20
Q

Returns truthy objects returned by the block

A

filter_map

21
Q

Returns flattened objects returned by the block.

A

flat_map, collect_concat

22
Q

Returns the object formed by combining all elements.

A

reduce, inject

23
Q

Returns the sum of the elements, using method +++.

A

sum

24
Q

returns a boolean value if any of the object in the enumerable satisfies the given condition, else it returns false.

A

.any?

25
Q

returns a boolean value true if all the objects in the enumerable satisfies the given condition, else it returns false.

A

.all?

26
Q

returns a boolean value true if none of the objects in the enumerable satisfies the given condition, else it returns false.

A

.none?