(Note) Explanation I have summarized it so that it can be used immediately with the minimum explanation. (Conclusion) If you remember either blank? Or prresent ?, you can do something about it.
** Used when you want to know if the contents are empty after satisfying the following conditions. ** ** ① There must be a container ② The contents are not numbers or true or false
If ①② is not satisfied, NoMethodError will occur.
** Used when you want to know if the contents are empty or exist in the first place **
irb(main):001:0> box = nil => nil irb(main):002:0> box.blank? => true
** Used when you want to know that it exists and the contents are not empty (synonymous with! Blank?) **
irb(main):006:0> box = nil => nil irb(main):007:0> box.present? => false
It was easy to understand because it covers the patterns in a tabular format.