Questions

Ruby questions

Choose a question page, learn the concept, then test your understanding with a quiz.

Ruby Object References and Mutable ActiveRecord Errors

Learn how Ruby variables reference objects and why ActiveRecord validation errors can change after save, with safe ways to preserve error messages.

rubyruby-on-railspass-by-reference

Ruby Question Mark Methods: Predicate Methods Explained

Learn what a question mark at the end of a Ruby method name means, how predicate methods work, and how to use them in conditions.

ruby

Ruby Safe Navigation Operator (&.): Meaning, Syntax, and Examples

Learn what Ruby's safe navigation operator (&.) does, how it prevents nil errors, and when to use it with clear examples.

rubyruby-on-rails

Ruby String Concatenation: Using Interpolation, +, and <<

Learn Ruby string concatenation with interpolation, +, and <<. Understand the differences, mutation behavior, and best practices.

rubystring-concatenation

Ruby Symbols and the Colon Syntax Explained

Learn what :name means in Ruby, how symbols differ from strings, and why symbols are common hash keys, method names, and identifiers.

rubysymbols

Ruby Terminal Text Colorization with ANSI Escape Codes

Learn to color Ruby terminal output with ANSI escape codes, foreground and background styles, reset sequences, and safe reusable helpers.

rubycolorsconsole-application

Ruby alias vs alias_method: When to Use Each

Learn the difference between Ruby alias and alias_method, when to use each, and how method aliasing works with clear examples.

rubyalias

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 case Statement with Multiple Values in when Clauses

Learn how to use Ruby case statements with multiple values in a when clause, plus patterns, examples, mistakes, and alternatives.

rubyswitch-statement

Ruby exec vs system vs backticks (%x): Differences, Return Values, and When to Use Each

Learn the difference between Ruby exec, system, and backticks (%x), including return values, process behavior, and practical use cases.

rubyexec

Ruby frozen_string_literal: true Explained for Beginners

Learn what `# frozen_string_literal: true` does in Ruby, how it affects string mutability, performance, and when to use it.

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.

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

Ruby lambda vs Proc.new: Differences, Return Behavior, and When to Use Each

Learn the differences between Ruby lambda and Proc.new, including arguments, return behavior, and when to use each in Ruby 1.8 and 1.9+.

rubylambdaproc

Ruby map Method: Transforming Range Values into Arrays

Learn what Ruby's map method does, how it transforms ranges and collections, and why calling map without a block returns an Enumerator.

rubydictionaryrangeenumeration

Ruby map vs collect: Is There Any Difference?

Learn the difference between Ruby map and collect, including syntax, behavior, performance, and when developers usually prefer one.

rubyarraysdictionarycollect

Ruby on Rails 4 Data Types Explained for Migrations and Models

Learn the available Ruby on Rails 4 data types for migrations, what they mean, and when to use each one in real projects.

rubyruby-on-railsruby-on-rails-4rails-activerecord

Ruby on Rails Instance Variables vs Local Variables Explained

Learn the difference between @variables and regular variables in Ruby on Rails, when to use each, and how scope affects controllers and views.

rubyruby-on-railsvariables

Ruby p vs puts: Output Methods Explained

Learn the difference between Ruby p and puts, including inspect vs to_s output, return values, arrays, debugging, examples, and common mistakes.

ruby

Page 7 of 9 - 162 questions