lib/activefacts/cql/compiler/constraint.rb in activefacts-cql-1.9.3 vs lib/activefacts/cql/compiler/constraint.rb in activefacts-cql-1.9.4
- old
+ new
@@ -516,30 +516,20 @@
@value_ranges = ast[:ranges]
@units = ast[:units]
@regular_expression = ast[:regular_expression]
end
- def assert_value(val)
- if val.is_a?(String)
- @constellation.Value(eval(val), true, nil)
- elsif val
- @constellation.Value(val.to_s, false , nil)
- else
- nil
- end
- end
-
def compile
@constraint = @constellation.ValueConstraint(:new)
raise "Units on value constraints are not yet processed (at line #{'REVISIT'})" if @units
# @string.line_of(node.interval.first)
if @value_ranges
@value_ranges.each do |range|
min, max = Array === range ? range : [range, range]
v_range = @constellation.ValueRange(
- min && @constellation.Bound(:value => assert_value(min), :is_inclusive => true),
- max && @constellation.Bound(:value => assert_value(max), :is_inclusive => true))
+ min && @constellation.Bound(:value => assert_literal_value(min), :is_inclusive => true),
+ max && @constellation.Bound(:value => assert_literal_value(max), :is_inclusive => true))
ar = @constellation.AllowedRange(@constraint, v_range)
end
else
@constraint.regular_expression = @regular_expression
end