Module: ESPN::Helpers
Overview
Instance Method Summary collapse
-
#blank?(object) ⇒ Boolean
Public: Determine if a given Object is blank? If it is a String, or anything that responds to :empty?, it will use that method.
Instance Method Details
#blank?(object) ⇒ Boolean
Public: Determine if a given Object is blank? If it is a String, or anything that responds to :empty?, it will use that method. If it does not respond to :empty? it will check that the Object is not nil.
object - The Object to check for blank.
Examples
blank?('')
# => true
blank?('foo')
# => false
blank?(nil)
# => true
blank?(Object.new)
# => false
Returns a Boolean.
33 34 35 |
# File 'lib/espn/helpers.rb', line 33 def blank?(object) object.respond_to?(:empty?) ? object.empty? : !object end |