Sha256: bcbd776973615e5eae48b7b998c675ce04501753c07a1f1ea616303c281abf27

Contents?: true

Size: 472 Bytes

Versions: 4

Compression:

Stored size: 472 Bytes

Contents

# frozen_string_literal: true

class Code
  class Node
    class Negation < 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/negation.rb
code-ruby-0.13.0 lib/code/node/negation.rb
code-ruby-0.12.0 lib/code/node/negation.rb
code-ruby-0.11.0 lib/code/node/negation.rb