Skip to content
Browse files

Added Object#blank? -- see http://redhanded.hobix.com/inspect/objectB…

…lank.html #783 [_why the lucky stiff]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@857 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 10a86b2 commit 4ef7bfb0166cb45428861ce9e001838ab9a2796f @dhh dhh committed Mar 6, 2005
Showing with 12 additions and 0 deletions.
  1. +2 −0 activesupport/CHANGELOG
  2. +10 −0 activesupport/lib/active_support/core_ext/object_and_class.rb
View
2 activesupport/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Added Object#blank? -- see http://redhanded.hobix.com/inspect/objectBlank.html #783 [_why the lucky stiff]
+
* Added inflection rules for "sh" words, like "wish" and "fish" #755 [phillip@pjbsoftware.com]
* Fixed an exception when using Ajax based requests from Safari because Safari appends a \000 to the post body. Symbols can't have \000 in them so indifferent access would throw an exception in the constructor. Indifferent hashes now use strings internally instead. #746 [Tobias Luetke]
View
10 activesupport/lib/active_support/core_ext/object_and_class.rb
@@ -11,6 +11,16 @@ def subclasses_of(superclass)
end
subclasses
end
+
+ def blank?
+ if respond_to? :empty?
+ empty?
+ elsif respond_to? :zero?
+ zero?
+ else
+ !self
+ end
+ end
end
class Class #:nodoc:

0 comments on commit 4ef7bfb

Please sign in to comment.
Something went wrong with that request. Please try again.