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.

rubyruby-on-railsruby-on-rails-3hashmap

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.

rubymethodsnaming-conventionsimmutability

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.

rubycomparisonoperatorsequality

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.

rubybundlergemfile

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.

rubykeywordcontinue

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.

rubyloops

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.

rubyclassmodule

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.

rubycode-formatting

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.

rubyattributesattr-accessor

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.

rubyexceptionerror-handling

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.

rubymoduleincludeextend

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.

rubyinheritanceintrospection

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.

rubygitversion-controlbundler

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.

rubysyntaxoperators

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.

rubymetaclasseigenclasssingleton

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.

rubyruby-on-rails

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.

rubyruby-on-railsauthenticity-token

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.

rubyarraysstringnotation

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.

rubysyntaxoperatorsparameter-passing

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.

ruby

Page 3 of 4 - 62 questions