Questions
Ruby questions
Choose a question page, learn the concept, then test your understanding with a quiz.
Remove a Key from a Hash in Ruby: delete vs reject and Returning the Remaining Hash
Learn how to remove keys from a Ruby Hash using delete, reject, except, and non-mutating patterns with clear examples and common pitfalls.
Ruby Bang Methods Explained: What ! Means in Ruby Method Names
Learn what exclamation marks mean in Ruby method names, when bang methods are used, and how they differ from non-bang methods.
Ruby Equality Methods Explained: equal?, eql?, ==, and ===
Learn the difference between Ruby's equal?, eql?, ==, and ===, with examples, semantics, and when each method is used.
Ruby Gemfile `require: false` Explained
Learn what `require: false` means in a Ruby Gemfile, how Bundler loads gems, and when to use it in real Ruby projects.
Ruby Loop Control: The Equivalent of continue in Ruby
Learn the Ruby equivalent of continue, how `next` works in loops, and when to use it with clear examples and common mistakes.
Ruby Loops: Alternatives to a do...while Loop in Ruby
Learn how to replace a do...while loop in Ruby using begin...end while, loop do, and input patterns for cleaner code.
Ruby Modules vs Classes: What’s the Difference and When to Use Each?
Learn the difference between Ruby modules and classes, when to use each, and how modules help with namespacing and shared behavior.
Ruby Multi-Line Strings Without Concatenation
Learn how to write multi-line strings in Ruby without messy concatenation, including heredoc, adjacent literals, and readable SQL examples.
Ruby attr_accessor vs attr_reader vs attr_writer Explained
Learn when to use Ruby's attr_accessor, attr_reader, and attr_writer, and why choosing the right one improves design and safety.
Ruby begin, rescue, and ensure Explained: Is ensure Like finally?
Learn how Ruby begin, rescue, and ensure work, when ensure runs, and how to safely handle files and exceptions in Ruby.
Ruby include vs extend: Understanding Modules and Mixins
Learn the difference between include and extend in Ruby, with clear examples of instance methods, class methods, and practical mixin usage.
Ruby kind_of? vs instance_of? vs is_a?: Differences and When to Use Them
Learn the difference between Ruby kind_of?, is_a?, and instance_of?, including inheritance behavior, examples, and when to use each.
Should Gemfile.lock Be Committed in Ruby? A Beginner-Friendly Guide
Learn when to commit Gemfile.lock in Ruby projects, when to ignore it, and how Bundler uses it for consistent dependencies.
Understanding Ruby's Double-Colon :: Operator
Learn what Ruby's :: operator does, how constants and namespaces work, and why it does not bypass private or protected access rules.
Understanding `class << self` in Ruby
Learn what `class << self` means in Ruby, how it works, when to use it, and how it compares to other ways of defining class methods.
Understanding nil?, empty?, and blank? in Ruby and Rails
Learn the difference between nil?, empty?, and blank? in Ruby on Rails with examples, comparisons, common mistakes, and practical usage.
Understanding the Rails Authenticity Token in Ruby on Rails
Learn what the Rails authenticity token is, why it exists, and how it protects forms from CSRF attacks in Ruby on Rails apps.
What %w Means in Ruby: Array of Strings Syntax Explained
Learn what %w means in Ruby, how it creates arrays of strings, when to use it, and how it compares to normal array syntax.
What `map(&:name)` Means in Ruby
Learn what `map(&:name)` means in Ruby, how `&:` works with `map`, and how it compares to block syntax in real Ruby and Rails code.
What attr_accessor Means in Ruby: Getters and Setters Explained
Learn what attr_accessor does in Ruby, how it creates getters and setters, and when to use attr_reader or attr_writer instead.