Introduction
Below is some instances method in Ruby might help you easily solving the issue.
.flatten()
.flatten()
is method will return a new array that flattening of itself and it also taking argument to determine the level of recursion to flatten.
.reverse()
.reverse()
method will return a new array containing self's elements in reverse order.
.rotate()
.rotate()
method will rotate first element of self and return by new array and it also taking argument to determine how many element need to rotate, if passing negative argument like (-1) then it will rotate in opposite direction
.insert()
.insert()
method is taking at least two argument, first argument is index of array, and second argument is value that you are going to insert, if using negative index will insert the value at the end of array
References:
API DOCK
Top comments (0)