Added native, faster implementations of .blank? for the core types #2286 [skae]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2319 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 1f4dc252
*SVN*
* Added native, faster implementations of .blank? for the core types #2286 [skae]
* Fixed clean logger to work with Ruby 1.8.3 Logger class #2245
* Fixed memory leak with Active Record classes when Dependencies.mechanism = :load #1704 [c.r.mcgrath@gmail.com]
......
# The methods here are provided to speed up function blank? in class Object
class NilClass
def blank?
true
end
end
class FalseClass
def blank?
true
end
end
class TrueClass
def blank?
false
end
end
class Array
alias_method :blank?, :empty?
end
class Hash
alias_method :blank?, :empty?
end
class String
def blank?
empty? || strip.empty?
end
end
class Numeric
alias_method :blank?, :zero?
end
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册