Useful Links
Computer Science
Programming
By Language
Ruby Programming Language
1. Introduction to Ruby
2. Ruby Syntax and Basic Concepts
3. Control Flow and Logic
4. Collections and Data Structures
5. Methods, Blocks, Procs, and Lambdas
6. Object-Oriented Programming (OOP) in Ruby
7. Advanced Ruby Concepts
8. The Ruby Ecosystem
9. Introduction to Ruby on Rails
Object-Oriented Programming (OOP) in Ruby
Classes and Objects
Defining a Class
class Keyword
Class Names
Class Body
Creating Instances (Objects)
new Method
Object Instantiation
The initialize Method (Constructor)
Constructor Parameters
Instance Variable Initialization
Constructor Overloading
Instance Variables (@variable)
Variable Scope
Encapsulation
Instance Methods
Method Definition
Method Access
self Reference
Object Identity and Equality
object_id
equal? Method
== Method
eql? Method
hash Method
Encapsulation
Public Methods
Default Visibility
Public Interface
Private Methods
private Keyword
Access Restrictions
Internal Implementation
Protected Methods
protected Keyword
Same Class Access
Attribute Accessors
attr_reader
attr_writer
attr_accessor
Custom Accessors
Access Control Keywords
Visibility Modifiers
Method Visibility Changes
Inheritance
Creating Subclasses
< Syntax
Parent Class Reference
The super Keyword
Calling Parent Methods
Parameter Passing
super vs super()
Overriding Methods
Method Redefinition
Polymorphism
The Object Hierarchy
BasicObject
Object
Module
Class
Inheritance Chain
Single Inheritance
One Parent Class
Multiple Inheritance Alternatives
Modules and Mixins
Defining a Module
module Keyword
Module Structure
Using Modules for Namespacing
Namespace Organization
Constant Scoping
Nested Modules
Using Modules as Mixins
include
prepend
extend
Method Lookup Chain
Differences between include, prepend, and extend
Instance vs Class Methods
Method Resolution Order
Use Cases
Constants in Modules
Module Constants
Constant Lookup
Module Callbacks
included Hook
extended Hook
prepended Hook
Class Variables and Class Methods
Class Variables (@@variable)
Shared State
Inheritance Behavior
Thread Safety Concerns
Defining Class Methods (self.method_name)
Class Method Syntax
Alternative Definitions
Singleton Methods
Object-Specific Methods
Eigenclass
Class Instance Variables
@variable in Class Context
vs Class Variables
Previous
5. Methods, Blocks, Procs, and Lambdas
Go to top
Next
7. Advanced Ruby Concepts