Sha256: 9ee091beb1f946bf75da4668f696d6d9b594074e50598141f17aef9f5393ee2c
Contents?: true
Size: 645 Bytes
Versions: 10
Compression:
Stored size: 645 Bytes
Contents
module DataMapper module Ext # Determines whether the specified +value+ is blank. # # An object is blank if it's false, empty, or a whitespace string. # For example, "", " ", +nil+, [], and {} are blank. # # @api semipublic def self.blank?(value) return value.blank? if value.respond_to?(:blank?) case value when ::NilClass, ::FalseClass true when ::TrueClass, ::Numeric false when ::Array, ::Hash value.empty? when ::String value !~ /\S/ else value.nil? || (value.respond_to?(:empty?) && value.empty?) end end end end
Version data entries
10 entries across 10 versions & 4 rubygems