【文件属性】:
文件名称:true_string:将字符串转换为布尔值
文件大小:4KB
文件格式:ZIP
更新时间:2021-06-22 13:31:12
Ruby
真字符串
可以转换为真值、 true和false的字符串集合。
"true" . truthy?
"false" . falsy?
"yes" . truthy?
"0" . falsy?
"○" . truthy?
":cross_mark:" . falsy?
"はい" . truthy?
#truthy? 返回true如果字符串可以解释为真,并返回false如果不是。 #falsy? 返回true如果字符串可以解释为假,返回false如果不是。
一个字符串不能同时为#truthy?返回true #truthy? 和#falsy? ,但可能对它们都返回false 。
Object也有truthy? 和falsy? .
Object . truthy?
nil . falsy?
如果接收者分别为真或假,这些方法将返回true 。
安装
将此行添加到应用程序的 Gemfile 中:
gem
【文件预览】:
true_string-master
----.gitignore(118B)
----true_string.gemspec(843B)
----LICENSE.txt(1KB)
----README.md(1KB)
----lib()
--------true_string()
--------true_string.rb(781B)
----Gemfile(96B)
----Rakefile(29B)