Sha256: 561e542544efbae97344760d08f89332c493d1fbb650e10c920921b134260216

Contents?: true

Size: 1.21 KB

Versions: 14

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

module Doing
  # Object helpers
  class ::Object
    ##
    ## Tests if object is nil or empty
    ##
    ## @return     [Boolean] true if object is defined and
    ##             has content
    ##
    def good?
      !nil? && !empty?
    end
  end

  class ::String
    ##
    ## Tests if object is nil or empty
    ##
    ## @return     [Boolean] true if object is defined and
    ##             has content
    ##
    def good?
      !strip.empty?
    end
  end

  class ::Array
    ##
    ## Tests if object is nil or empty
    ##
    ## @return     [Boolean] true if object is defined and
    ##             has content
    ##
    def good?
      !nil? && !empty?
    end
  end

  class ::FalseClass
    ##
    ## Tests if object is nil or empty
    ##
    ## @return     [Boolean] true if object is defined and
    ##             has content
    ##
    def good?
      false
    end

    def normalize_tag_sort
      :time
    end
  end

  class ::TrueClass
    ##
    ## Tests if object is nil or empty
    ##
    ## @return     [Boolean] true if object is defined and
    ##             has content
    ##
    def good?
      true
    end

    def normalize_tag_sort
      :name
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
doing-2.1.40 lib/doing/good.rb
doing-2.1.39 lib/doing/good.rb
doing-2.1.38 lib/doing/good.rb
doing-2.1.37 lib/doing/good.rb
doing-2.1.36 lib/doing/good.rb
doing-2.1.35 lib/doing/good.rb
doing-2.1.34 lib/doing/good.rb
doing-2.1.33 lib/doing/good.rb
doing-2.1.32 lib/doing/good.rb
doing-2.1.31pre lib/doing/good.rb
doing-2.1.30 lib/doing/good.rb
doing-2.1.29 lib/doing/good.rb
doing-2.1.28 lib/doing/good.rb
doing-2.1.27 lib/doing/good.rb