Tag Archives: Ruby Collections

The grep() of enumerable is an inbuilt method in Ruby returns an array of elements which contain every (element == pattern), of all the elements… Read More
The reverse_each() of enumerable is an inbuilt method in Ruby returns the elements of the temporary array. The temporary array contains the enumerable in reverse… Read More
The sort() of enumerable is an inbuilt method in Ruby returns an array which contains the enum items in a sorted order. The comparisons are… Read More
The each_cons() of enumerable is an inbuilt method in Ruby iterates for consecutive N elements starting from each element every time. If no block is… Read More
The each_with_index() of enumerable is an inbuilt method in Ruby hashes the items in the enumerable according to the given block. In case no block… Read More
The sort_by() of enumerable is an inbuilt method in Ruby sorts enum using a set of keys generated by mapping the values in enum through… Read More
The each_with_object() of enumerable is an inbuilt method in Ruby iterates for every object and returns the initial object. It returns the enumerator, if no… Read More
The entries() of enumerable is an inbuilt method in Ruby returns the items in the enumerable. Syntax: enu.entries Parameters: The function does not takes any… Read More
The any?() of enumerable is an inbuilt method in Ruby returns a boolean value if any of the object in the enumerable satisfies the given… Read More
The find_all() of enumerable is an inbuilt method in Ruby returns the items in the enumerable which satisfies the given condition in the block. It… Read More
The select() of enumerable is an inbuilt method in Ruby returns the items in the enumerable which satisfies the given condition in the block. It… Read More
The find_index() of enumerable is an inbuilt method in Ruby returns the index of the item which returns true for the given condition in the… Read More
The first() of enumerable is an inbuilt method in Ruby returns the first N elements or the first element of the enumerable. If there is… Read More
Any constant value which can be assigned to the variable is called as literal/constant. we use literal every time when typing an object in the… Read More
Array#find_index() : find_index() is a Array class method which returns the index of the first array. If a block is given instead of an argument,… Read More