From ac58ba60f6cfc272992129ce28808e37391b95d7 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Wed, 2 Nov 2005 15:37:58 +0000 Subject: Changed 0.blank? to false rather than true since it violates everyone's expectation of blankness. Closes #2518, Closes #2705. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2849 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activesupport/lib/active_support/core_ext/blank.rb | 4 ---- activesupport/lib/active_support/core_ext/object_and_class.rb | 10 ++++------ 2 files changed, 4 insertions(+), 10 deletions(-) (limited to 'activesupport/lib/active_support') diff --git a/activesupport/lib/active_support/core_ext/blank.rb b/activesupport/lib/active_support/core_ext/blank.rb index 113a8645f9..f4c0b24c25 100644 --- a/activesupport/lib/active_support/core_ext/blank.rb +++ b/activesupport/lib/active_support/core_ext/blank.rb @@ -30,7 +30,3 @@ class String #:nodoc: empty? || strip.empty? end end - -class Numeric #:nodoc: - alias_method :blank?, :zero? -end \ No newline at end of file diff --git a/activesupport/lib/active_support/core_ext/object_and_class.rb b/activesupport/lib/active_support/core_ext/object_and_class.rb index cff8fca5bb..1e080d35a4 100644 --- a/activesupport/lib/active_support/core_ext/object_and_class.rb +++ b/activesupport/lib/active_support/core_ext/object_and_class.rb @@ -14,19 +14,17 @@ class Object #:nodoc: subclasses end - # "", " ", nil, and 0 are all blank + # "", " ", nil, [], and {} are blank def blank? if respond_to?(:empty?) && respond_to?(:strip) - strip.empty? - elsif respond_to? :empty? + empty? or strip.empty? + elsif respond_to?(:empty?) empty? - elsif respond_to? :zero? - zero? else !self end end - + def suppress(*exception_classes) begin yield rescue Exception => e -- cgit v1.2.3