Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to require the IRB library.
Ruby
require '[1]'
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'rails' or other unrelated libraries instead of 'irb'.
Forgetting to put the library name in quotes.
✗ Incorrect
The IRB library is required by using require 'irb'.
2fill in blank
mediumComplete the code to start a new IRB session programmatically.
Ruby
IRB.[1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using methods like 'run' or 'open' which do not exist on IRB module.
Calling methods without capitalization.
✗ Incorrect
Use IRB.start to launch a new IRB session from Ruby code.
3fill in blank
hardFix 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase or undefined symbols like :simple or :basic.
Using strings instead of symbols.
✗ Incorrect
The symbol :SIMPLE sets a basic prompt style in IRB.
4fill in blank
hardFill 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'
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.
✗ Incorrect
Define a custom prompt named :MY_PROMPT with input prompt string '>> '.
5fill in blank
hardFill 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'
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.
✗ Incorrect
Set the prompt mode to :MY_PROMPT, define the prompt strings, and start IRB with IRB.start.