is_match = (exact.include? var_value) || (from.nil? || var_value > from) && (to.nil? || var_value < to)
and there is no need to initialize it separately tree lines above.