Sha256: 90c2038fccebfc8d70955c1ff3b394f9de5b86884bc9a9f5f100568637a00826

Contents?: true

Size: 467 Bytes

Versions: 4

Compression:

Stored size: 467 Bytes

Contents

# frozen_string_literal: true

class Code
  class Node
    class Not < Node
      def initialize(parsed)
        return if parsed.blank?
        @operator = parsed.delete(:operator).presence
        @right = Node::Statement.new(parsed.delete(:right).presence)
      end

      def evaluate(**args)
        if @right
          @right.evaluate(**args).call(operator: @operator, **args)
        else
          Object::Nothing.new
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
code-ruby-0.13.1 lib/code/node/not.rb
code-ruby-0.13.0 lib/code/node/not.rb
code-ruby-0.12.0 lib/code/node/not.rb
code-ruby-0.11.0 lib/code/node/not.rb