Sha256: ee1b8db97477b2b988a5636cbf3f895aa75d54eafda0066fc610d1ed38cf3de0

Contents?: true

Size: 601 Bytes

Versions: 45

Compression:

Stored size: 601 Bytes

Contents

require 'set'

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

  class NilClass
    def blank?
      true
    end
  end

  class FalseClass
    def blank?
      true
    end
  end

  class TrueClass
    def blank?
      false
    end
  end

  class Set
    alias :blank? :empty?
  end

  class String
    def blank?
      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?
      !blank?
    end
  end
end

Version data entries

45 entries across 35 versions & 4 rubygems

Version Path
riak-client-1.1.1 lib/riak/core_ext/blank.rb
riak-client-1.1.0 lib/riak/core_ext/blank.rb
better-riak-client-1.0.7 lib/riak/core_ext/blank.rb
better-riak-client-1.0.6 lib/riak/core_ext/blank.rb
riak-client-1.0.5 lib/riak/core_ext/blank.rb
better-riak-client-1.0.5 lib/riak/core_ext/blank.rb
riak-client-1.0.3 pkg/riak-client-1.0.2/pkg/riak-client-1.0.0/lib/riak/core_ext/blank.rb
riak-client-1.0.3 pkg/riak-client-1.0.2/lib/riak/core_ext/blank.rb
riak-client-1.0.3 pkg/riak-client-1.0.1/pkg/riak-client-1.0.0/lib/riak/core_ext/blank.rb
riak-client-1.0.3 pkg/riak-client-1.0.2/pkg/riak-client-1.0.1/pkg/riak-client-1.0.0/lib/riak/core_ext/blank.rb
riak-client-1.0.3 pkg/riak-client-1.0.0/lib/riak/core_ext/blank.rb
riak-client-1.0.3 lib/riak/core_ext/blank.rb
riak-client-1.0.3 pkg/riak-client-1.0.1/lib/riak/core_ext/blank.rb
riak-client-1.0.3 pkg/riak-client-1.0.2/pkg/riak-client-1.0.1/lib/riak/core_ext/blank.rb
riak-client-1.0.2 pkg/riak-client-1.0.1/pkg/riak-client-1.0.0/lib/riak/core_ext/blank.rb
riak-client-1.0.2 pkg/riak-client-1.0.1/lib/riak/core_ext/blank.rb
riak-client-1.0.2 pkg/riak-client-1.0.0/lib/riak/core_ext/blank.rb
riak-client-1.0.2 lib/riak/core_ext/blank.rb
riak-client-1.0.0 lib/riak/core_ext/blank.rb
seomoz-riak-client-1.0.0.pre lib/riak/core_ext/blank.rb