Sha256: 58a66903c3c22210175ee0a1f59639c6c4444ee59cac8abb5c8986b6b4da5e54
Contents?: true
Size: 999 Bytes
Versions: 17
Compression:
Stored size: 999 Bytes
Contents
module Spruz module Blank module Object def blank? respond_to?(:empty?) ? empty? : !self end def present? !blank? end end module NilClass def blank? true end end module FalseClass def blank? true end end module TrueClass def blank? false end end module Array def self.included(modul) modul.module_eval do alias_method :blank?, :empty? end end end module Hash def self.included(modul) modul.module_eval do alias_method :blank?, :empty? end end end module String def blank? self !~ /\S/ end end module Numeric def blank? false end end end unless Object.respond_to?(:blank?) for k in Blank.constants Object.const_get(k).class_eval do include Blank.const_get(k) end end end end
Version data entries
17 entries across 17 versions & 1 rubygems