Sha256: 2df71a07133f8d4aa6b3c748f88ae2bdcf9ceaca9f8ab92313177832128bf877

Contents?: true

Size: 569 Bytes

Versions: 5

Compression:

Stored size: 569 Bytes

Contents

module JMESPath
  # @api private
  module Util
    class << self

      # Determines if a value is false as defined by JMESPath:
      #
      #   https://github.com/jmespath/jmespath.site/blob/master/docs/proposals/improved-filters.rst#and-expressions-1
      #
      def falsey?(value)
        value.nil? ||
        value === false ||
        value == '' ||
        value == {} ||
        value == [] ||
        (value.respond_to?(:entries) && value.entries.compact.empty?)
        # final case necessary to support Enumerable and Struct
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
jmespath-1.2.4 lib/jmespath/util.rb
jmespath-1.2.3 lib/jmespath/util.rb
jmespath-1.2.2 lib/jmespath/util.rb
jmespath-1.2.1 lib/jmespath/util.rb
jmespath-1.2 lib/jmespath/util.rb