Bird
0
0

Which of the following is the correct syntax to set a custom prompt mode in ~/.irbrc?

easy📝 Syntax Q3 of 15
Ruby - Ecosystem and Best Practices
Which of the following is the correct syntax to set a custom prompt mode in ~/.irbrc?
AIRB.prompt_mode = 'SIMPLE'
BIRB.set_prompt(:SIMPLE)
Cset IRB.prompt = 'SIMPLE'
DIRB.conf[:PROMPT_MODE] = :SIMPLE
Step-by-Step Solution
Solution:
  1. Step 1: Recall correct IRB prompt setting syntax

    The correct way is to assign a symbol to IRB.conf[:PROMPT_MODE].
  2. Step 2: Check each option for syntax correctness

    Only IRB.conf[:PROMPT_MODE] = :SIMPLE uses correct Ruby hash and symbol syntax.
  3. Final Answer:

    IRB.conf[:PROMPT_MODE] = :SIMPLE -> Option D
  4. Quick Check:

    Set prompt with IRB.conf[:PROMPT_MODE] = :symbol [OK]
Quick Trick: Use IRB.conf[:PROMPT_MODE] = :your_mode to set prompt [OK]
Common Mistakes:
  • Using method calls instead of hash assignment
  • Using strings instead of symbols
  • Incorrect assignment syntax

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes