Class: NilClass
Overview
module Enumerable
# True if the collection is `empty?`
#
# @example
# [1,2].blank? #=> false
# [].blank? #=> false
#
unless respond_to?(:blank?)
def blank?
empty?
end
def present?
not empty?
end
end
Combinators collapse
-
#try(*args) ⇒ Object
Returns ‘nil` (when `self` is `nil`).
Instance Method Summary collapse
-
#blank? ⇒ Boolean
Always ‘true`.
- #present? ⇒ Boolean
Instance Method Details
#blank? ⇒ Boolean
Always ‘true`. Note this overrides Object#blank? which returns false.
45 46 47 |
# File 'lib/ruby/blank.rb', line 45 def blank? true end |
#present? ⇒ Boolean
49 50 51 |
# File 'lib/ruby/blank.rb', line 49 def present? false end |
#try(*args) ⇒ Object
Returns ‘nil` (when `self` is `nil`). This overrides Object#try
42 43 44 |
# File 'lib/ruby/try.rb', line 42 def try(*args) self end |