Class: Wood::Nodes::Operator
Constant Summary collapse
- BOOL_OPS =
[:<, :>, :<=, :>=, :==, :"!=", :"&&", :"||"]
- NON_BOOL_OPS =
[:*, :/, :+, :-, :>>, :<<, :&, :|]
Instance Method Summary collapse
Instance Method Details
#boolean? ⇒ Boolean
8 9 10 |
# File 'lib/wood/nodes/operator.rb', line 8 def boolean? BOOL_OPS.include? name end |
#to_boolean ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/wood/nodes/operator.rb', line 12 def to_boolean if boolean? return self else return Operator[name: :"!=", left: self, right: IntLiteral[0]] end end |