Ruby’s singleton methods are the methods that can be defined for a specific object only i.e. it works for a single object. These kinds of… Read More
Tag Archives: Ruby-Methods
Method invocation refers to how a method is called in a program. The process of invoking a method in Ruby is quite easy since the… Read More
split is a String class method in Ruby which is used to split the given string into an array of substrings based on a pattern… Read More
What is method overloading? Method overloading is a feature that allows a class to have more than one method with same name but different method… Read More
In any programming language, there are two types of functions: 1. PURE FUNCTIONS 2. IMPURE FUNCTIONSThere is a basic difference between the two, that is… Read More
Method visibility in Ruby refers that instance methods can be public, private or protected. Methods are by default public unless they are explicitly declared private… Read More
The process in which a function calls itself directly or indirectly is called recursion and the corresponding function is called a recursive function. Recursion makes… Read More
Class Methods are the methods that are defined inside the class, public class methods can be accessed with the help of objects. The method is… Read More
In a Ruby class we may want to expose the instance variables (the variables that are defined prefixed by @ symbol) to other classes for… Read More
The uniq() of enumerable is an inbuilt method in Ruby returns an array removing all the duplicates in the given enum. Syntax: enu.uniq Parameters: The… Read More
The drop_while() of enumerable is an inbuilt method in Ruby returns an array containing the rest elements after dropping elements up to, but not including,… Read More
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 include?() of enumerable is an inbuilt method in Ruby returns a boolean value. It returns true if the enumerable contains the given elements, or… 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 drop() of enumerable is an inbuilt method in Ruby returns the rest elements in the enumerator after dropping the first N elements. Syntax: block.drop(N)… Read More