aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-03-06 14:22:21 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-03-06 14:22:21 +0000
commit4ef7bfb0166cb45428861ce9e001838ab9a2796f (patch)
tree8cf6c942f9fa704726e0801ccaba548de4401c48 /activesupport/lib/active_support/core_ext
parent10a86b21fbf702b5382dbc95953d935b91ae2c41 (diff)
downloadrails-4ef7bfb0166cb45428861ce9e001838ab9a2796f.tar.gz
rails-4ef7bfb0166cb45428861ce9e001838ab9a2796f.tar.bz2
rails-4ef7bfb0166cb45428861ce9e001838ab9a2796f.zip
Added Object#blank? -- see http://redhanded.hobix.com/inspect/objectBlank.html #783 [_why the lucky stiff]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@857 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support/core_ext')
-rw-r--r--activesupport/lib/active_support/core_ext/object_and_class.rb10
1 files changed, 10 insertions, 0 deletions
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 59a463ae29..eb54f79534 100644
--- a/activesupport/lib/active_support/core_ext/object_and_class.rb
+++ b/activesupport/lib/active_support/core_ext/object_and_class.rb
@@ -11,6 +11,16 @@ class Object #:nodoc:
end
subclasses
end
+
+ def blank?
+ if respond_to? :empty?
+ empty?
+ elsif respond_to? :zero?
+ zero?
+ else
+ !self
+ end
+ end
end
class Class #:nodoc: