Write as a complement to vague knowledge about instance methods. If you have any mistakes, I would appreciate it if you could comment.
-If a method is defined in the class definition expression, it becomes an instance method. (Corrected from syntax to definition formula) -Can be called for an instance of that class.
class Car #Define an instance method (here name method) def name "yellow cab" end end #name of the class.Create an instance with new and assign it to the variable taxi taxi = Car.new #Call an instance method taxi.name #=> "yellow cab"
-Instance method is defined in the class. -Create an instance and then call the instance method. -The instance method can be called by "instance.method".
-Methods, classes, and instance methods were ambiguous https://qiita.com/right1121/items/c74d350bab32113d4f3d ・ [Ruby] I tried to learn about classes and instances again. https://qiita.com/ksk_diffeasy/items/734b4961e9e6c7480d33 ・ "Introduction to Ruby for those who aim to become professionals" Junichi Ito [Author] https://ruby-book.jnito.com/