[Why] /home/baijing/compass-ci/lib/dump_stat.rb:171:in `number?': undefined local variable or method `monitor' for DumpStat:Module (NameError) Did you mean? @monitor
Signed-off-by: Lu Weitao luweitaobe@163.com --- lib/dump_stat.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/dump_stat.rb b/lib/dump_stat.rb index 1c0695e..de0168e 100644 --- a/lib/dump_stat.rb +++ b/lib/dump_stat.rb @@ -55,7 +55,7 @@ module DumpStat if value.is_a?(String) value = check_string_value(k, value, @monitor) next unless value - return nil unless number?(value, @invalid_records) + return nil unless number?(value, @invalid_records, @record_index, @monitor)
value = value.index('.') ? value.to_f : value.to_i elsif value.is_a?(Array) @@ -64,7 +64,7 @@ module DumpStat
value[i] = check_string_value(k, value[i], @monitor) next unless value[i] - return nil unless number?(value[i], @invalid_records) + return nil unless number?(value[i], @invalid_records, @record_index, @monitor)
value[i] = value[i].index('.') ? value[i].to_f : value[i].to_i valid_stats_verification(k, value[i]) @@ -165,7 +165,7 @@ def check_string_value(key, value, monitor) end
# only number is valid -def number?(value, invalid_records) +def number?(value, invalid_records, record_index, monitor) unless value.numeric? invalid_records.push record_index warn_stat "invalid stats value: #{value}", monitor