当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Ruby VerboseFormatter.message_for用法及代码示例


本文简要介绍ruby语言中 DidYouMean::VerboseFormatter.message_for 的用法。

用法

message_for(corrections)

返回包含 corrections 的人类可读字符串。这个格式化程序被设计成不那么冗长,不会占用太多的屏幕空间,同时对用户有足够的帮助。

@例子

formatter = DidYouMean::Formatter.new

# displays suggestions in two lines with the leading empty line
puts formatter.message_for(["methods", "method"])

Did you mean?  methods
                method
# => nil

# displays an empty line
puts formatter.message_for([])

# => nil

相关用法


注:本文由纯净天空筛选整理自ruby-lang.org大神的英文原创作品 VerboseFormatter.message_for。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。