0
0
Rubyprogramming~5 mins

IRB customization in Ruby - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is IRB in Ruby?
IRB stands for Interactive Ruby Shell. It allows you to write and execute Ruby code interactively, line by line.
Click to reveal answer
intermediate
How can you customize the IRB prompt?
You can customize the IRB prompt by setting the IRB.conf[:PROMPT] hash with your own prompt strings and then selecting it with IRB.conf[:PROMPT_MODE].
Click to reveal answer
beginner
What file is commonly used to customize IRB settings automatically on start?
The .irbrc file in your home directory is used to customize IRB settings automatically when IRB starts.
Click to reveal answer
intermediate
How do you enable syntax highlighting in IRB?
You can enable syntax highlighting in IRB by requiring the irb/ext/colorize extension in your .irbrc file.
Click to reveal answer
intermediate
What is the purpose of IRB.conf[:SAVE_HISTORY]?
It controls whether IRB saves your command history between sessions, allowing you to recall previous commands.
Click to reveal answer
Which file is used to customize IRB settings automatically on startup?
Aruby_config.yml
Birb_config.rb
C.irbrc
Dconfig.rb
How do you change the IRB prompt style?
ABy setting IRB.conf[:PROMPT] and IRB.conf[:PROMPT_MODE]
BBy editing the ruby interpreter source code
CBy changing the terminal font
DBy installing a gem
Which Ruby command enables syntax highlighting in IRB?
Arequire 'syntax/highlight'
Brequire 'irb/ext/colorize'
Crequire 'colorize'
Drequire 'irb/syntax'
What does IRB.conf[:SAVE_HISTORY] control?
ASaving IRB configuration files
BSaving terminal output
CSaving Ruby scripts automatically
DSaving command history between sessions
Where do you put Ruby code to customize IRB behavior?
AIn the .irbrc file
BIn the Gemfile
CIn the ruby executable
DIn the .ruby-version file
Explain how to customize the IRB prompt and save your changes for every session.
Think about prompt hashes and the startup config file.
You got /3 concepts.
    Describe how to enable command history and syntax highlighting in IRB.
    Focus on history saving and colorizing extensions.
    You got /3 concepts.