I find myself repeatedly looking for a clear definition of the differences of nil?
我發現本身一再尋找nil?
差別的明肯定義nil?
, blank?
, blank?
, and empty?
, empty?
in Ruby on Rails. 在Ruby on Rails中。 Here's the closest I've come: 這是我最接近的: spa
blank?
objects are false, empty, or a whitespace string. 對象是false,空或空白字符串。 For example, ""
, " "
, nil
, []
, and {}
are blank. 例如, ""
, " "
, nil
, []
和{}
爲空。 .net
nil?
objects are instances of NilClass. 對象是NilClass的實例。 code
empty?
objects are class-specific, and the definition varies from class to class. 對象是特定於類的,而且定義因類而異。 A string is empty if it has no characters, and an array is empty if it contains no items. 若是字符串沒有字符,則該字符串爲空;若是字符串不包含任何項目,則該字符串爲空。 對象
Is there anything missing, or a tighter comparison that can be made? 有什麼遺漏,或者能夠作出更嚴格的比較嗎? ci