Sha256: e854b9dd4cf36fbddd9ffd5deabd6107e281983dda3eb50cd9e1028d201073dd

Contents?: true

Size: 645 Bytes

Versions: 2

Compression:

Stored size: 645 Bytes

Contents

# frozen_string_literal: true

require 'forwardable'

module DynamoidAdvancedWhere
  module Nodes
    class NotNode
      extend Forwardable

      attr_accessor :sub_node

      def_delegators :@sub_node,
                     :expression_attribute_names,
                     :expression_attribute_values

      def initialize(sub_node:)
        self.sub_node = sub_node
        freeze
      end

      def to_expression
        "NOT(#{sub_node.to_expression})"
      end
    end

    module Concerns
      module Negatable
        def negate
          NotNode.new(sub_node: self)
        end
        alias ! negate
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
dynamoid_advanced_where-1.0.0 lib/dynamoid_advanced_where/nodes/not.rb
dynamoid-advanced-where-1.0.0 lib/dynamoid_advanced_where/nodes/not.rb