Sha256: 14a758429e3df6edfdb2c440a507d85f5cd027d43fc2ca923d0d1f2f5a67367d
Contents?: true
Size: 735 Bytes
Versions: 2
Compression:
Stored size: 735 Bytes
Contents
# partialy extracted from # https://github.com/rails/rails/blob/5-0-stable/activesupport/lib/active_support/core_ext/object/blank.rb class Object def blank? !self end def empty? blank? end def present? !blank? end end class NilClass def blank? true end end class FalseClass def blank? true end end class TrueClass def blank? false end end class Array def blank? self.length == 0 end end class Hash def blank? self.keys.length == 0 end end class Numeric def blank? false end end class Time def blank? false end end class String def blank? return true if self.length == 0 # test = !!(self =~ /^\s*$/) !(self =~ /[^\s]/) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
lux-fw-0.2.3 | ./lib/overload/blank.rb |
lux-fw-0.2.1 | ./lib/overload/blank.rb |