Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/core_ext/object.rb
Instance Method Summary collapse
- #blank? ⇒ Boolean
-
#present? ⇒ Boolean
From: activesupport/lib/active_support/core_ext/object/blank.rb, line 19.
-
#try(*a, &b) ⇒ Object
From: activesupport/lib/active_support/core_ext/object/try.rb, line 28.
Instance Method Details
#blank? ⇒ Boolean
5 6 7 |
# File 'lib/core_ext/object.rb', line 5 def blank? respond_to?(:empty?) ? empty? : !self end |
#present? ⇒ Boolean
From: activesupport/lib/active_support/core_ext/object/blank.rb, line 19
12 13 14 |
# File 'lib/core_ext/object.rb', line 12 def present? !blank? end |
#try(*a, &b) ⇒ Object
From: activesupport/lib/active_support/core_ext/object/try.rb, line 28
19 20 21 22 23 24 25 |
# File 'lib/core_ext/object.rb', line 19 def try(*a, &b) if a.empty? && block_given? yield self else __send__(*a, &b) end end |