Home
Ruby programming language tutorial
This Ruby tutorial is designed for both students and developers. It covers a wide range of Ruby topics with clear explanations and practical examples.
What is Ruby?
Ruby is a high-level, open-source programming language created in 1995 by Yukihiro Matsumoto, designed to be simple, enjoyable, and productive. It is object-oriented and widely used for building desktop applications, creating static websites, processing data, automating tasks, managing web servers, supporting DevOps, web scraping, crawling, and developing database-driven web applications.
Ruby History
Ruby 0.95 was the first version of the Ruby which was released in 1995, then various substantial versions were released in the following years:
- In 1996, Ruby 1.0 was released.
- In 1998, Ruby 1.2 was introduced to the market.
- Ruby 1.4 and Ruby 1.6 were released in 1999 and 2000 respectively.
- After this many versions were introduced with better features and the latest version of Ruby is Ruby 2.6.0 which was released on Christmas, 2018.
Ruby Features
-
Object-Oriented
Ruby follows object-oriented principles with some procedural features, offering:
- Abstraction: Simplifies complexity by modeling classes suited to the problem.
- Polymorphism: Enables objects or methods to adapt to different inputs.
- Encapsulation: Protects objects from unauthorized access by hiding internal states.
- Inheritance: Allows new classes to derive properties from existing ones, like a parent-child relationship.
-
Mixins and Metaclasses
- Mixins: Allow methods from one class to be used in another without making it a parent class.
- Metaclasses: Special classes that define the behavior of specific classes and their objects.
-
Dynamic Typing and Duck Typing
- Dynamic Typing: Determines variable types at runtime.
- Duck Typing: Checks if an object can perform the required tasks rather than verifying its type.
-
Interpreted Language
Ruby executes instructions directly without pre-compiling into machine or bytecode.
-
Garbage Collection
Ruby handles memory automatically, allocating and deallocating as needed, avoiding manual memory management.
Ruby Tutorial Topics
Explore key Ruby topics, from basics to advanced concepts, with practical examples:
Ruby Overview
Ruby Basics
Ruby Control Statements
Ruby Methods
Ruby Classes and Methods
Ruby Arrays
Ruby Sets
Ruby Strings
Ruby Classes & Objects
Ruby Hash
Ruby Tools
Ruby Functions
Ruby Built-in Functions
Misc.
Ruby programs
Showing latest programs on the top...
Ruby Find Output Programs