用Ruby写代码分析、重构工具和自动重构、格式程序等等甚至更多的工具并非不可能,但是很困难,因为还没有用Ruby代码分析Ruby源码的先例。
Code analyzers, refactoring tools and automated refactorings, formatters and more, are difficult, if not impossible, to write in Ruby, because there is no way to parse Ruby source with Ruby code.
您甚至可以将值指定为可选,并定义格式化程序用于简单值与文本之间的转换。
You can even specify values as optional, and define formatters for converting simple values to and from text.
再添加一个数字实参就能告诉格式化程序要使用多少个小数位。
Adding a number argument as well will tell the formatter how many decimal digits to use.
So the end result, because someone wrote this function years ago is that printf takes this thing, takes this thing, David plops David inside the middle of that formatted string and then renders the whole result.
基于这是某人多年以前写的程序,最终的结果是打印出这个,这个,在格式化字符串中间的,然后返回结果。
Right, so an exception then has this format that I can control as a programmer.
好的,所以一个异常会有这样的格式,我能把他当做一个程序员来控制。
应用推荐