ruby irb 提示模式有什么区别? [英] What's the difference between the ruby irb prompt modes?
问题描述
我可以用
irb --prompt prompt-mode
我可以看到 null
和 simple
的作用,但我无法区分 null
和 xmp
和 default
/classic
/inf-ruby
的区别.有人可以向我解释这些其他模式的作用吗?让多个模式做同样的事情似乎毫无意义.
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.
推荐答案
这些问题的答案在 IRB.conf[:PROMPT] 中,它是一个哈希,其键是不同的提示,其值是每个提示的配置.阅读本文以了解提示的配置.
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.
null 和 xmp 的区别在于 xmp 显示的结果用箭头缩进:
The difference between null and xmp is that xmp displays a result indented with an arrow:
$ irb --prompt xmp -f
2**10
==>1024
而 null 不缩进或显示箭头:
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.
这篇关于ruby irb 提示模式有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!