lib/gorillib/object/blank.rb in gorillib-0.0.2 vs lib/gorillib/object/blank.rb in gorillib-0.0.3

- old
+ new

@@ -6,14 +6,26 @@ # [1].blank? #=> false # [nil].blank? #=> false # # @return [TrueClass, FalseClass] # - # @api public def blank? nil? || (respond_to?(:empty?) && empty?) end + + ## + # Returns true if the object is NOT nil or empty + # + # [].present? #=> false + # [1].present? #=> true + # [nil].present? #=> true + # + # @return [TrueClass, FalseClass] + # + def present? + not blank? + end end # class Object class Numeric ## # Numerics are never blank @@ -22,11 +34,10 @@ # 1.blank? #=> false # 6.54321.blank? #=> false # # @return [FalseClass] # - # @api public def blank? false end end # class Numeric @@ -36,11 +47,10 @@ # # nil.blank? #=> true # # @return [TrueClass] # - # @api public def blank? true end end # class NilClass @@ -50,11 +60,10 @@ # # true.blank? #=> false # # @return [FalseClass] # - # @api public def blank? false end end # class TrueClass @@ -64,11 +73,10 @@ # # false.blank? #=> true # # @return [TrueClass] # - # @api public def blank? true end end # class FalseClass @@ -80,10 +88,9 @@ # " ".blank? #=> true # " hey ho ".blank? #=> false # # @return [TrueClass, FalseClass] # - # @api public def blank? strip.empty? end end # class String