Questions

Ruby questions

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

Fix OpenSSL Header Errors When Installing Ruby Gems on macOS

Learn why native Ruby gems cannot find openssl/ssl.h on macOS and how to pass correct OpenSSL include and library paths.

rubymacosopensslhomebrew

Fix Ruby require LoadError in Homebrew on macOS

Learn why Homebrew can raise Ruby’s “cannot load such file -- utils/popen” error and safely diagnose or repair a damaged installation.

rubymacosrubygemshomebrew

Fix RubyGems SSL Certificate Verification Errors on macOS

Learn why RubyGems SSL certificate verification fails on macOS and how to update trusted CA certificates without using insecure HTTP sources.

rubyruby-on-railssslrvm

Fixing Ruby Gem Native Extension Errors: mkmf.rb Can't Find Header Files for Ruby

Learn why Ruby gem installs fail with missing ruby.h, how native extensions work, and how to fix header file errors on Linux servers.

rubyjsonrubygems

Fixing S3 Endpoint Errors in Ruby AWS SDK

Learn why the S3 bucket endpoint error happens in Ruby AWS SDK and how to fix bucket region, endpoint, and object key issues correctly.

rubyruby-on-railsamazon-web-servicesamazon-s3

Get All File Names from a Folder in Ruby

Learn how to list all file names from a folder in Ruby using Dir, glob patterns, and filtering, with examples and common mistakes.

rubyfiledirectoryfilenames

Get the Current Working Directory Absolute Path in Ruby

Learn how to retrieve Ruby’s current working directory as an absolute path using Dir.pwd, Dir.getwd, and File.expand_path.

rubyirbworking-directory

Handling Currency and Money in Ruby on Rails

Learn the safest way to store, format, and display money in Rails, including cents, integers, and view helpers for currency output.

rubyruby-on-railscurrency

Handling STDIN and Command-Line Arguments in Ruby

Learn how Ruby reads standard input and ARGV, handles empty redirected input, and builds command-line programs that work with pipes and files.

rubystdin

How to Add One Array to Another in Ruby Without Creating a Nested Array

Learn how to combine arrays in Ruby without getting nested arrays or nil values. Understand push, concat, +, and flatten clearly.

rubyarraysmultidimensional-array

How to Break Out of a Ruby Block and Return from a Method

Learn how Ruby blocks handle return, break, and next, and how to stop iteration or exit the outer method safely and clearly.

ruby

How to Call Shell Commands from Ruby and Capture Output

Learn how to run shell commands in Ruby, capture output, check exit status, and choose the right method for scripts and apps.

rubyshellinterop

How to Capture Command Output in Ruby: system vs Backticks and Open3

Learn how to get shell command output in Ruby, when system returns only true/false, and how to capture stdout and stderr safely.

rubysystemcall

How to Check Whether a String Contains a Substring in Ruby

Learn how to check if a string contains a substring in Ruby using include?, match, and multiline string examples.

rubystring

How to Check if a Hash Key Exists in Ruby

Learn how to check whether a specific key exists in a Ruby hash using key?, has_key?, and include? with clear examples.

rubydata-structuresassociative-array

How to Check if a Value Exists in an Array in Ruby

Learn how to check whether a value exists in a Ruby array using include?, with examples, common mistakes, and practical use cases.

rubyarrays

How to Check if a Variable Is Defined in Ruby

Learn how to check whether a variable is defined in Ruby using `defined?`, with examples for local, instance, class, and global variables.

rubyreflection

How to Convert a Ruby Hash to JSON

Learn how to convert a Ruby Hash to JSON in Ruby and Rails, including require statements, examples, common errors, and best practices.

rubyruby-on-railsjsonhashmap

How to Convert a String to Lowercase or Uppercase in Ruby

Learn how to convert strings to lowercase or uppercase in Ruby using upcase, downcase, and related methods with simple examples.

rubystringuppercaselowercase

How to Determine an Object’s Type in Ruby

Learn how to check an object’s type in Ruby using class, is_a?, and kind_of?, with examples and common mistakes for beginners.

rubytypes

Page 2 of 9 - 162 questions