Sha256: 8be5b6c96a54d29daa49d24a4b65f5cc15be80883dd7259a7bc396b7ad3d535f
Contents?: true
Size: 528 Bytes
Versions: 2
Compression:
Stored size: 528 Bytes
Contents
module Aequitas # 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) 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
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
aequitas-0.0.2 | lib/aequitas/support/blank.rb |
aequitas-0.0.1 | lib/aequitas/support/blank.rb |