What's the difference between the ruby irb prompt modes?

irb, ruby

Solution

The answer to those questions lie in IRB.conf[:PROMPT] which is a hash whose keys are the different prompts and whose values are the configurations for each prompt. Read this to a understand a prompt's configuration.

The difference between null and xmp is that xmp displays a result indented with an arrow:

$ irb --prompt xmp -f
2**10
    ==>1024

while null doesn't indent or display the arrow:

$ irb --prompt null -f
2**10
1024

You should be able to answer your second question once you read the above link and understand that prompts have different modes and different configurations for them.

Problem

I can change the irb prompt mode with ``` irb --prompt prompt-mode ``` I can see what `null` and `simple` does, but I can't tell the difference between `null` and `xmp` and the difference between `default`/`classic`/`inf-ruby`. Can someone explain to me what these other modes do? It seems pointless to have multiple modes doing the same thing.

Original source