Sha256: b9e63418eebc81f661f75c87624a9aca3a7352271a227ea7b71976d93393dd5e
Contents?: true
Size: 997 Bytes
Versions: 1
Compression:
Stored size: 997 Bytes
Contents
# stolen from ActiveSupport class Object unless method_defined?(:blank?) def blank? respond_to?(:empty?) ? empty? : !self end end unless method_defined?(:present?) def present? !blank? end end unless method_defined?(:presence) def presence self if present? end end end class NilClass unless method_defined?(:blank?) def blank? true end end end class FalseClass unless method_defined?(:blank?) def blank? true end end end class TrueClass unless method_defined?(:blank?) def blank? false end end end class Array unless method_defined?(:blank?) alias_method :blank?, :empty? end end class Hash unless method_defined?(:blank?) alias_method :blank?, :empty? end end class String unless method_defined?(:blank?) def blank? self !~ /[^[:space:]]/ end end end class Numeric unless method_defined?(:blank?) def blank? false end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
airbrake-3.1.6 | lib/airbrake/extensions/blank.rb |