From a3caf28da3a22c1326d3d98dcf71483a8edaa55a Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 12 Jun 2008 18:30:56 -0500 Subject: Added Object#present? which is equivalent to !Object#blank? [DHH] --- activesupport/lib/active_support/core_ext/blank.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/core_ext/blank.rb b/activesupport/lib/active_support/core_ext/blank.rb index dfe33162e8..4f8dc4e281 100644 --- a/activesupport/lib/active_support/core_ext/blank.rb +++ b/activesupport/lib/active_support/core_ext/blank.rb @@ -12,6 +12,11 @@ class Object def blank? respond_to?(:empty?) ? empty? : !self end + + # An object is present if it's not blank. + def present? + !blank? + end end class NilClass #:nodoc: -- cgit v1.2.3