Sha256: d5ce5ba51d55b30f2e77ba1c5f74152ca803ec7306a3052bb1c937ce95d797e0

Contents?: true

Size: 342 Bytes

Versions: 1

Compression:

Stored size: 342 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require 'treetop'
require_relative 'boolean_expr'

# A boolean expression with one child
class UnaryExpr < BooleanExpr
  def truthy?(context)
    if negated.text_value.length.positive?
      !elements[1].val.truthy?(context)
    else
      elements[1].val.truthy?(context)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
emerald-lang-1.0.0 lib/emerald/nodes/unary_expr.rb