Questions
Ruby questions
Choose a question page, learn the concept, then test your understanding with a quiz.
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.
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.
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.
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.
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.
How to Disable RI and RDoc by Default for gem install in Ruby
Learn how to make gem install skip RI and RDoc by default using RubyGems configuration, with examples and common mistakes.
How to Drop Columns in a Rails Migration
Learn the Rails migration syntax for dropping database columns safely, with examples, reversibility, and common mistakes.
How to Execute a Command Line Binary in Node.js
Learn how to run command line binaries in Node.js using child_process, with examples, safety tips, and real CLI use cases.
How to Fix RubyGems Permission Errors When Installing Gems in Ruby
Learn why RubyGems permission errors happen and how to safely install gems or update RubyGems without write access issues.
How to Generate a Random Number in Ruby
Learn how to generate random numbers in Ruby, including ranges, inclusive and exclusive bounds, and beginner-friendly examples.
How to Generate a Random String in Ruby
Learn how to generate random strings in Ruby using arrays, ranges, and SecureRandom with clear examples and common pitfalls.
How to Get the Current Absolute URL in Ruby on Rails
Learn how to get the full current URL in a Ruby on Rails view, including protocol, host, path, and query string.
How to Install a Specific Version of a Ruby Gem
Learn how to install a specific gem version in Ruby using the gem command, with syntax, examples, common mistakes, and real-world usage.
How to Match All Regular Expression Occurrences in Ruby
Learn how to find every regex match in Ruby using scan, to_enum, and MatchData with clear examples and common pitfalls.
How to Pass Command Line Arguments to a Rake Task in Ruby
Learn how to pass command line arguments to Rake tasks in Ruby, including task parameters, environment variables, and calling tasks from other tasks.
How to Pick a Random Element from an Array in Ruby
Learn how to choose a random item from an array in Ruby using Array#sample, with examples, mistakes to avoid, and practical use cases.
How to Remove RVM (Ruby Version Manager) from Your System
Learn how to remove RVM from your system safely, including shell cleanup, PATH changes, and verifying Ruby environment settings.
How to Remove Whitespace in Ruby: strip, lstrip, rstrip, and gsub
Learn how to remove whitespace in Ruby using strip, lstrip, rstrip, and gsub, and how they compare to PHP trim().
How to Write Multi-Line Comments in Ruby
Learn how multi-line comments work in Ruby, including =begin/=end, line comments, common mistakes, and practical Ruby examples.
How to Write a Switch Statement in Ruby
Learn how switch-style logic works in Ruby using `case`, `when`, and `else`, with examples, common mistakes, and practical usage tips.
Page 1 of 2 - 32 questions