Skip to content

Instantly share code, notes, and snippets.

@webmat
Created November 21, 2008 20:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webmat/27603 to your computer and use it in GitHub Desktop.
Save webmat/27603 to your computer and use it in GitHub Desktop.
# IRB prompt that looks like code samples
IRB.conf[:USE_READLINE] = true
IRB.conf[:AUTO_INDENT] = false
my_conf = IRB.conf[:PROMPT][:COPY] = {}
my_conf[:PROMPT_N] = ""
my_conf[:PROMPT_S] = ""
my_conf[:PROMPT_I] = ""
my_conf[:PROMPT_C] = ""
my_conf[:RETURN] = "#=> %s\n\n"
IRB.conf[:PROMPT_MODE] = :COPY
#Following is an exact copy/paste of a few commands run from IRB
=begin
a = [:bleh, :foo, 'bar']
#=> [:bleh, :foo, "bar"]
a.reject{|e| e.is_a? Symbol}
#=> ["bar"]
5**4
#=> 625
=end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment