Bird
0
0

Which command sets the Ruby version only for the current project directory using rbenv?

easy📝 Conceptual Q2 of 15
Ruby - Ecosystem and Best Practices
Which command sets the Ruby version only for the current project directory using rbenv?
A<code>rbenv global 2.7.5</code>
B<code>rbenv install 2.7.5</code>
C<code>rbenv shell 2.7.5</code>
D<code>rbenv local 2.7.5</code>
Step-by-Step Solution
Solution:
  1. Step 1: Understand rbenv local usage

    This command sets the Ruby version for the current directory by writing it to a .ruby-version file.
  2. Step 2: Differentiate from other commands

    rbenv global sets the default version system-wide, rbenv shell sets it temporarily for the shell session, and rbenv install installs a new Ruby version.
  3. Final Answer:

    rbenv local 2.7.5 -> Option D
  4. Quick Check:

    Set project Ruby version = rbenv local [OK]
Quick Trick: Use rbenv local to set Ruby version per project folder [OK]
Common Mistakes:
  • Using rbenv global instead of local for project scope
  • Confusing rbenv shell with persistent version setting
  • Trying to install Ruby with local command

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes