Ruby method. Works on any objects, including nil and NULL
Ruby method
Used on strings, array and hashes
Doesn't work on nil!
Returns true if the .length
is 0 --> even if there's a whitespace in a string, it won't be empty
nil.empty? # NoMethodError
[nil].empty? # false
' '.empty? # false
```
## .blank?
ActiveRecord method
Can be used on any objects.
For strings, arrays and hashes acts like .empty?
Except for whitespaces - they are considered blank
````ruby
nil.blank? # true
[nil].blank? # false
' '.blank? # true
```
##.present?
ActiveSupport method
it's the opposite of `.blank?``
`!something.blank? == something.present?``
````ruby
nil.present? # false
[nil].present? # true
' '.present? # false
```
##.any?
ActiveSupport method
Only works on arrays and AR collections
Passes every element of the collection to a given block and returns true if any of the element calls returns anything other that nil or false
````ruby
[nil, false].any? # false
[nil, false].any? { |element| element == true } # false
```
So, any vs present
```ruby
[nil, false].present? # true
[nil, false].any? # false
```