Module: JMESPath::Util Private

Defined in:
lib/jmespath/util.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Class Method Summary collapse

Class Method Details

.falsey?(value) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

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

Returns:

  • (Boolean)

10
11
12
13
14
15
# File 'lib/jmespath/util.rb', line 10

def falsey?(value)
  !value ||
  (value.respond_to?(:empty?) && value.empty?) ||
  (value.respond_to?(:entries) && !value.entries.any?)
  # final case necessary to support Enumerable and Struct
end