Sha256: 6abeacc8a09f1dceea740786a0b284e5dd9efb3393dcc015b7e666fc22dc95f5

Contents?: true

Size: 473 Bytes

Versions: 1

Compression:

Stored size: 473 Bytes

Contents

unless Object.new.respond_to? :blank?
  class Object
    def blank?
      false
    end
  end

  class NilClass
    def blank?
      true
    end
  end

  class Set
    alias :blank? :empty?
  end

  class String
    def blank?
      not self =~ /[^\s]/
    end
  end

  class Array
    alias :blank? :empty?
  end

  class Hash
    alias :blank? :empty?
  end
end

unless Object.new.respond_to? :present?
  class Object
    def present?
      not blank?
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
riak-client-0.8.3 lib/riak/core_ext/blank.rb