Class: UnaryExpr

Inherits:
BooleanExpr
  • Object
show all
Defined in:
lib/emerald/nodes/unary_expr.rb

Overview

A boolean expression with one child

Instance Method Summary collapse

Instance Method Details

#truthy?(context) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
13
14
15
# File 'lib/emerald/nodes/unary_expr.rb', line 9

def truthy?(context)
  if negated.text_value.length.positive?
    !elements[1].val.truthy?(context)
  else
    elements[1].val.truthy?(context)
  end
end