Ruby Study Cards

Enhance Your Understanding with Ruby Programming Concept Cards for quick learning



Ruby

A dynamic, object-oriented programming language known for its simplicity and productivity.

Variable

A named storage location that holds a value, which can be changed during program execution.

Data Types

The classification of data that determines the operations that can be performed on it. Ruby has built-in data types like strings, numbers, booleans, arrays, and hashes.

String

A sequence of characters enclosed in single or double quotes. Ruby provides various methods to manipulate strings.

Integer

A whole number without a fractional or decimal part. Ruby supports both positive and negative integers.

Float

A number with a fractional or decimal part. Ruby uses floating-point numbers to represent real numbers.

Boolean

A data type that represents either true or false. Used for logical operations and conditional statements.

Array

An ordered collection of elements, accessed by their index. Ruby arrays can contain different data types and can be dynamically resized.

Hash

A collection of key-value pairs, where each unique key is associated with a value. Also known as dictionaries or associative arrays.

Operator

A symbol or keyword that performs an operation on one or more operands. Ruby supports arithmetic, comparison, logical, and assignment operators.

Control Flow

The order in which statements are executed in a program. Ruby provides if-else, switch, and loop statements for controlling the flow of execution.

Conditional Statement

A statement that performs different actions based on a condition. In Ruby, if-else and case statements are used for conditional execution.

Loop

A control flow statement that repeatedly executes a block of code until a certain condition is met. Ruby provides while, until, and for loops.

Method

A reusable block of code that performs a specific task. Ruby methods can have parameters and return values.

Class

A blueprint for creating objects that define their properties and behaviors. Ruby supports object-oriented programming with classes and inheritance.

Object

An instance of a class that encapsulates data and behavior. Objects are created from classes and can interact with each other.

Module

A container for organizing similar methods and constants. Ruby modules can be mixed into classes to provide additional functionality.

Exception

An error or unexpected event that occurs during program execution. Ruby provides exception handling mechanisms to gracefully handle errors.

File Operations

Reading from and writing to files using Ruby. File operations include opening, closing, reading, writing, and manipulating files.

Regular Expression

A sequence of characters that defines a search pattern. Ruby supports regular expressions for pattern matching and text manipulation.

Ruby Gems

Packages or libraries that extend the functionality of Ruby. Gems can be easily installed and used in Ruby projects.

Debugging

The process of finding and fixing errors or bugs in a program. Ruby provides debugging techniques like printing debug statements and using a debugger.

Best Practices

Recommended coding conventions and techniques for writing clean, maintainable, and efficient Ruby code.

Syntax

The set of rules that define the structure and format of a programming language. Ruby has a concise and readable syntax.

Comments

Text in a program that is ignored by the interpreter or compiler. Ruby supports single-line and multi-line comments for documentation and code readability.

Variables

Named containers that store values in memory. Ruby variables are dynamically typed and do not require explicit declaration.

Constants

Named values that cannot be changed once assigned. Ruby constants are typically used for values that should not be modified.

Operators

Symbols or keywords that perform operations on operands. Ruby supports arithmetic, comparison, logical, assignment, and bitwise operators.

Conditional Operators

Operators used for comparing values and making decisions. Ruby has operators like ==, !=, >, <, >=, <= for conditional statements.

Logical Operators

Operators used for combining conditions and performing logical operations. Ruby has operators like &&, ||, ! for logical expressions.

Assignment Operators

Operators used for assigning values to variables. Ruby has operators like =, +=, -=, *=, /= for assignment operations.

Arithmetic Operators

Operators used for performing mathematical calculations. Ruby has operators like +, -, *, /, % for addition, subtraction, multiplication, division, and modulus.

String Concatenation

The process of combining two or more strings into a single string. In Ruby, the + operator is used for string concatenation.

Array Indexing

Accessing elements in an array using their index. Ruby arrays are zero-based, meaning the first element has an index of 0.

Hash Keys

Unique identifiers used to access values in a hash. Ruby hashes store key-value pairs and allow efficient retrieval of values based on keys.

Method Parameters

Values passed to a method when it is called. Ruby methods can have zero or more parameters, which are used to provide input to the method.

Method Return Values

Values returned by a method after it completes its execution. Ruby methods can have a return statement to specify the value to be returned.

Class Inheritance

The process of creating a new class based on an existing class. Ruby supports single inheritance, where a class inherits properties and behaviors from a parent class.

Module Mixin

The process of including a module in a class to extend its functionality. Ruby modules can be mixed into multiple classes, providing code reusability.

Exception Handling

The process of handling errors or exceptions that occur during program execution. Ruby provides try-catch blocks to catch and handle exceptions.

File Reading

Reading data from a file using Ruby. File reading operations include opening a file, reading its contents, and closing the file.

File Writing

Writing data to a file using Ruby. File writing operations include opening a file, writing data to it, and closing the file.

Regular Expression Matching

Searching for patterns in text using regular expressions. Ruby provides methods like match and scan for pattern matching and extraction.

Ruby Gem Installation

The process of installing Ruby gems for use in a project. Ruby gems can be installed using the gem command or by specifying them in the project's Gemfile.

Debugging Techniques

Methods and tools used for finding and fixing errors in a program. Ruby provides debugging techniques like printing debug statements, using a debugger, and logging.

Code Readability

The quality of code that makes it easy to understand and maintain. Ruby emphasizes code readability with its concise and expressive syntax.

Code Reusability

The ability to reuse code in multiple parts of a program. Ruby supports code reusability through classes, modules, and inheritance.

Code Efficiency

The optimization of code to improve its performance and resource usage. Ruby provides various techniques for writing efficient code.

Error Handling

The process of dealing with errors or exceptions in a program. Ruby provides exception handling mechanisms to gracefully handle errors and prevent program crashes.

Documentation

The process of creating and maintaining documentation for a program. Ruby supports documentation generation using tools like RDoc and YARD.

Testing

The process of verifying the correctness and functionality of a program. Ruby has testing frameworks like RSpec and MiniTest for writing automated tests.

Version Control

The management of changes to a program using version control systems. Ruby projects can be easily managed with Git, SVN, or other version control tools.

Debugging Tools

Software tools used for debugging and troubleshooting programs. Ruby provides debugging tools like Pry, Byebug, and RubyMine.

Performance Optimization

The process of improving the performance of a program. Ruby provides techniques like code profiling and optimization to enhance program speed.

Code Refactoring

The process of restructuring existing code to improve its readability, maintainability, and efficiency. Ruby supports code refactoring with tools like RuboCop and Reek.