File: not.rb

package info (click to toggle)
ruby-jmespath 1.6.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 232 kB
  • sloc: ruby: 2,039; makefile: 4
file content (18 lines) | stat: -rw-r--r-- 342 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true
module JMESPath
  module Nodes
    class Not < Node
      def initialize(expression)
        @expression = expression
      end

      def visit(value)
        JMESPath::Util.falsey?(@expression.visit(value))
      end

      def optimize
        self.class.new(@expression.optimize)
      end
    end
  end
end