Everything is an object in Ruby. That means, each symbol or variable you create must be an object of a Class. For example, if you type the string “Hello!”; that must be an object of the String class. Don’t you believe? Here it is an example. “Hello!”.class You will see the class name String will be […]
Ruby Programming Language
Ruby Programming – Inheritance in Ruby
Inheritance is one of the great feature in Object Oriented Programming. Ruby supports inheritance. Inheritance allows to inherit the features of the base classes to its derived classes. That means, through derived class objects we can access the features of the base class. Through this Article, we will discuss how we use Inheritance in Ruby. […]
Ruby Programming – How to generate Getter and Setter methods automatically?
In our previous Article, we have discussed about Getter and Setter methods in Ruby. We no need to add these methods explicitly; instead, Ruby provides a way to Automatically generate these methods to us. In this Article, we will discuss about generating Getter and Setter methods Automatically in Ruby. The attr_ methods Ruby provides keywords, […]
Ruby Programming – Getter and Setter methods
Ruby allows defining class and instance variables. Ruby doesn’t allow us to access the variables of the class directly; instead, we can use methods to access or modify the variables of the class. We have discussed an overview of classes in Ruby through my previous Article “Ruby Programming – An Overview on Classes“. Through this […]
Ruby Programming – Classes – How to create class methods?
We have discussed an introduction to the Classes in Ruby in my previous Article “Ruby Programming – An Overview on Classes“. There we have seen defining classes and creating objects to the classes using the class’s new method. And also discussed that the classes have instance methods and class methods. There are different ways we […]
Ruby Programming – An Overview on Classes
As we discussed in our previous Articles, Ruby is a pure object-oriented language. That means, everything is an object of a class in Ruby. Non-object things are NOT exists in Ruby. Unlike C++ where you can write the program without classes or objects; in Ruby we CAN NOT write programs without classes or objects. Hence […]
Ruby Programming – The Basics of Ruby
Ruby is a pure object-oriented programming language. That means, everything is an object in Ruby. For example, 3 is an object of Number class. If you type 3.methods; it will return all the methods defined in the Number class. Similarly, if you type 3.class; you will see the type of the class this object is […]
Ruby Programming – Interactive shell
Once we installed Ruby, we will get one powerful command line interactive Ruby-programming environment called irb (Interactive Ruby). irb is a command line interpreter allowed to enter Ruby commands and instantly see the results in the environment itself. This is very useful when learning Ruby. In this article we will discuss about invoking ruby command-line interpreter, […]
Ruby Programming: An Introduction
Ruby is a popular open source, cross-platform, object-oriented, dynamic, scripting, interpreted programming language. It was invented in the year 1993 by Yukihiro Matsumoto (Matz). Ruby is cross-platform, that means if we develop a Ruby program based on one machine; it’s likely to run the same program without any changes on different machines. In order to develop or run […]