Course Content

Course Content


  • Instance Method is a class in Ruby that instantiates an object by calling its constructor with a block of code.
  • When you want to create an object, you can do it using the Instance Method. This method will create an object and then call its constructor with the block of code that you provide.

The Instance Method allows you to create methods which are specific to an object. Object.method is a generic method that can be applied to any object.

The Instance Method is used when we need to use the same method on many different objects. For example, we can use it when we want to print out a list of all the people in our database.

To use this method, we write:

  • Person.instance_method(:name)
  • And then call it with any object in our database such as "John" or "Jane".

A class in Ruby is an entity that serves as a template for the creation of other objects. The methods available on any instance of a class are defined by the class. When a method is defined inside a class, it becomes an instance method on that class. That method will be available in any future instance of that class.

A function that is attached to a class instance is called an instance method. To instance methods, the class instance is implicitly supplied as the first argument. It is fundamentally unique to that instance. An instance method is the most common form of method.

Share With Friend

Have a friend to whom you would want to share this course?

Download LearnVern App

App Preview Image
App QR Code Image
Code Scan or Download the app
Google Play Store
Apple App Store
598K+ Downloads
App Download Section Circle 1
4.57 Avg. Ratings
App Download Section Circle 2
15K+ Reviews
App Download Section Circle 3
  • Learn anywhere on the go
  • Get regular updates about your enrolled or new courses
  • Share content with your friends
  • Evaluate your progress through practice tests
  • No internet connection needed
  • Enroll for the webinar and join at the time of the webinar from anywhere