Sha256: 5d6147f84205e7cfbc78dd721d697cdc9dbbde82926bb90b7c0cff4e68c9122b

Contents?: true

Size: 645 Bytes

Versions: 28

Compression:

Stored size: 645 Bytes

Contents

# frozen_string_literal: true
# A core library extension that defines the method nil_or_empty? as an alias to
# optimize checks for nil? or empty? on common object types such as NilClass,
# String, Array, Hash, and Numeric.

class NilClass
  alias nil_or_empty? nil? unless method_defined? :nil_or_empty?
end

class String
  alias nil_or_empty? empty? unless method_defined? :nil_or_empty?
end

class Array
  alias nil_or_empty? empty? unless method_defined? :nil_or_empty?
end

class Hash
  alias nil_or_empty? empty? unless method_defined? :nil_or_empty?
end

class Numeric
  alias nil_or_empty? nil? unless method_defined? :nil_or_empty?
end

Version data entries

28 entries across 28 versions & 2 rubygems

Version Path
asciidoctor-2.0.4 lib/asciidoctor/core_ext/nil_or_empty.rb
asciidoctor-2.0.3 lib/asciidoctor/core_ext/nil_or_empty.rb
asciidoctor-2.0.2 lib/asciidoctor/core_ext/nil_or_empty.rb
asciidoctor-2.0.1 lib/asciidoctor/core_ext/nil_or_empty.rb
asciidoctor-2.0.0 lib/asciidoctor/core_ext/nil_or_empty.rb
asciidoctor-2.0.0.rc.3 lib/asciidoctor/core_ext/nil_or_empty.rb
asciidoctor-2.0.0.rc.2 lib/asciidoctor/core_ext/nil_or_empty.rb
asciidoctor-2.0.0.rc.1 lib/asciidoctor/core_ext/nil_or_empty.rb