Challenge - 5 Problems
Ruby Version Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate1:30remaining
What is the output of this rbenv command?
You run the command
rbenv versions after installing Ruby 3.1.2 and 2.7.6. What output will you see?Ruby
$ rbenv versions system * 3.1.2 (set by /home/user/.rbenv/version) 2.7.6
Attempts:
2 left
💡 Hint
The asterisk (*) marks the currently active Ruby version.
✗ Incorrect
The
rbenv versions command lists installed Ruby versions. The active version is marked with an asterisk and shows the file that sets it.❓ Predict Output
intermediate1:30remaining
What happens when you run
rvm use 2.6.5 if Ruby 2.6.5 is not installed?You run
rvm use 2.6.5 but Ruby 2.6.5 is not installed on your system. What will be the result?Ruby
rvm use 2.6.5Attempts:
2 left
💡 Hint
The plain `rvm use` command requires the version to be installed first; use `rvm install` separately.
✗ Incorrect
RVM's `rvm use` command switches to an already installed Ruby version. If not installed, it shows an error like 'ruby-2.6.5 is not installed'.
🔧 Debug
advanced2:00remaining
Why does
ruby -v show a different version than rbenv version?You set Ruby 3.0.0 as global with
rbenv global 3.0.0, but running ruby -v shows Ruby 2.7.0. What is the most likely cause?Attempts:
2 left
💡 Hint
Check if
rbenv commands are recognized and PATH is set correctly.✗ Incorrect
If
rbenv is not initialized in your shell PATH, the system Ruby will be used instead of the selected version.📝 Syntax
advanced1:30remaining
Which command correctly sets a local Ruby version with rbenv?
You want to set Ruby 3.2.0 only for the current project directory. Which command is correct?
Attempts:
2 left
💡 Hint
Local version affects only the current directory and subdirectories.
✗ Incorrect
The
rbenv local command writes the version to a .ruby-version file in the current directory.🚀 Application
expert2:30remaining
How to ensure a Ruby script uses a specific Ruby version with rvm in a CI pipeline?
You want your CI pipeline to run a Ruby script using Ruby 2.7.4 managed by RVM, without affecting other jobs. Which is the best approach?
Attempts:
2 left
💡 Hint
RVM can install and switch Ruby versions on the fly in scripts.
✗ Incorrect
Using
rvm use 2.7.4 --install --binary --fuzzy ensures Ruby 2.7.4 is installed if missing and switches to it only for that session.