0
0
Rubyprogramming~10 mins

IRB customization in Ruby - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to require the IRB library.

Ruby
require '[1]'
Drag options to blanks, or click blank then click option'
Ajson
Brails
Cirb
Dnet/http
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'rails' or other unrelated libraries instead of 'irb'.
Forgetting to put the library name in quotes.
2fill in blank
medium

Complete the code to start a new IRB session programmatically.

Ruby
IRB.[1]
Drag options to blanks, or click blank then click option'
Abegin
Bstart
Copen
Drun
Attempts:
3 left
💡 Hint
Common Mistakes
Using methods like 'run' or 'open' which do not exist on IRB module.
Calling methods without capitalization.
3fill in blank
hard

Fix the error in the code to customize IRB prompt with a simple string.

Ruby
IRB.conf[:PROMPT_MODE] = :[1]
Drag options to blanks, or click blank then click option'
ASIMPLE
BDEFAULT
CCUSTOM
DBASIC
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase or undefined symbols like :simple or :basic.
Using strings instead of symbols.
4fill in blank
hard

Fill both blanks to define a custom IRB prompt hash with prompt and return strings.

Ruby
IRB.conf[:PROMPT][:[1]] = {
  PROMPT_I: '[2]',
  RETURN: '=> '
}
Drag options to blanks, or click blank then click option'
AMY_PROMPT
B>
C>>
DDEFAULT
Attempts:
3 left
💡 Hint
Common Mistakes
Using default prompt names instead of a custom one.
Using wrong prompt strings that don't end with a space.
5fill in blank
hard

Fill all four blanks to set IRB to use your custom prompt and start the session.

Ruby
IRB.conf[:PROMPT_MODE] = :[1]
IRB.conf[:PROMPT][:[1]] = {
  PROMPT_I: '[2]',
  RETURN: '=> '
}
IRB.[3]
Drag options to blanks, or click blank then click option'
AMY_PROMPT
B>>
C=>
Dstart
Attempts:
3 left
💡 Hint
Common Mistakes
Using different symbols for prompt mode and prompt hash.
Forgetting to call IRB.start to launch the session.
Using incorrect prompt strings without spaces.