lib/cldr-plurals/ruby_emitter.rb in cldr-plurals-1.1.0 vs lib/cldr-plurals/ruby_emitter.rb in cldr-plurals-1.1.1
- old
+ new
@@ -30,15 +30,15 @@
"#{var} = runtime.#{var}(num)"
end.join('; ')
end
def emit_or_condition(cond)
- "(#{emit(cond.left)} || #{emit(cond.right)})"
+ "((#{emit(cond.left)}) || (#{emit(cond.right)}))"
end
def emit_and_condition(cond)
- "(#{emit(cond.left)} && #{emit(cond.right)})"
+ "((#{emit(cond.left)}) && (#{emit(cond.right)}))"
end
def emit_expression(expr)
case expr.value
when CldrPlurals::Compiler::Range
@@ -82,10 +82,10 @@
end
end
def emit_range_check(range, operand)
# a..b represents all *integers* between a and b, inclusive.
- n = emit(operand)
+ n = "(#{emit(operand)})"
"(#{n}.floor == #{n}) && (#{n} >= #{range.start}) && (#{n} <= #{range.finish})"
end
def emit_operator(op)
case op.symbol