Skip to content

Instantly share code, notes, and snippets.

@lusis
Created January 26, 2011 16:07
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save lusis/796928 to your computer and use it in GitHub Desktop.
Add this to disable irb echo
# via http://tagaholic.me/2009/05/29/exploring-how-to-configure-irb.html#echo
def irb_verbosity_toggle
irb_context.echo ? irb_context.echo = false : irb_context.echo = true
end
@Spidy88
Copy link

Spidy88 commented Mar 4, 2013

A much more concise version, but the first line below can throw an exception if echo is set to a non-boolean class

Do an XOR with true to toggle the value

irb_context.echo ^= true

Or not itself

irb_context.echo = !irb_context.echo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment