Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Ruby Programming
Previous Page Home Next Page

Initialization File

irb uses an initialization file in which you can set commonly used options or execute any required Ruby statements. When irb is run, it will try to load an initialization file from one of the following sources in order: ~/.irbrc, .irbrc, irb.rc, _irbrc, and $irbrc.

Within the initialization file you may run any arbitrary Ruby code. You can also set any of the configuration values that correspond to command-line arguments as shown in Table B.2 on page 518.
irb configuration values

IRB.conf[:IRB_NAME] = "irb" IRB.conf[:MATH_MODE] = false
IRB.conf[:USE_TRACER] = false IRB.conf[:USE_LOADER] = false
IRB.conf[:IGNORE_SIGINT] = true IRB.conf[:IGNORE_EOF] = false
IRB.conf[:INSPECT_MODE] = nil IRB.conf[:IRB_RC] = nil
IRB.conf[:BACK_TRACE_LIMIT] = 16 IRB.conf[:USE_LOADER] = false
IRB.conf[:USE_READLINE] = nil IRB.conf[:USE_TRACER] = false
IRB.conf[:IGNORE_SIGINT] = true IRB.conf[:IGNORE_EOF] = false
IRB.conf[:PROMPT_MODE] = :DEFAULT IRB.conf[:PROMPT] = { ... }
IRB.conf[:DEBUG_LEVEL] = 0 IRB.conf[:VERBOSE] = true

As an interesting twist on configuring irb, you can set IRB.conf[:IRB_RC] to a Proc object. This proc will be invoked whenever the irb context is changed, and will receive that new context as a parameter. You can use this facility to change the configuration dynamically based on the context.
Ruby Programming
Previous Page Home Next Page

 
 
  Published under the terms of the Open Publication License Design by Interspire