Sha256: aa82fe6141695ffbb9f837d4a1d950dc1c3034885ff491be3012202e10a8c6db

Contents?: true

Size: 842 Bytes

Versions: 1

Compression:

Stored size: 842 Bytes

Contents

if !nil.respond_to?(:blank?)
  class Object
    def blank?
      respond_to?(:empty?) ? empty? : !self
    end

    if not defined? Object::present?
      # An object is present if it's not blank.
      #
      # @return [true, false]
      def present?
        !blank?
      end
    end

  end
  
  class NilClass #:nodoc:
    def blank?
      true
    end
  end
  
  class FalseClass #:nodoc:
    def blank?
      true
    end
  end
  
  class TrueClass #:nodoc:
    def blank?
      false
    end
  end
  
  class Array #:nodoc:
    alias_method :blank?, :empty?
  end
  
  class Hash #:nodoc:
    alias_method :blank?, :empty?
  end
  
  class String #:nodoc:
    def blank?
      self !~ /\S/
    end
  end
  
  class Numeric #:nodoc:
    def blank?
      false
    end
  end  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cloudinary-1.0.82 lib/cloudinary/missing.rb