What is the name of the method that is the opposite of String#blank? (return bool)

ic(1.20.0-dev):001> "hello".present?
error in line 0
Error: expanding macro


In <top-level>:1:9

 1 | "hello".present?
             ^-------
Error: undefined method 'present?' for String

Did you mean 'presence'?
ic(1.20.0-dev):002> "hello".presence
 => "hello"
ic(1.20.0-dev):003> "hello".blank?
 => false
ic(1.20.0-dev):004>

Thanks

!"hello".blank?? Tho could prob also just do "hello".presence and that’ll ensure it’s not nil or blank. Can you share more about the use case?

I just curious why we are not add a #present? method to String(as ruby on rails), only because we have presence available? presence is not always return Bool, it not good when use as condition.

Does it matter? The only things it could return are a String which is truthy and nil which is falsey, so should just work out of the box.

Yes, this is a method return Bool, and method ends with ?, like this.

Links to related discussions in Ruby