'TypeError:没有将nil隐式转换为String'错误

时间:2018-09-21 21:22:34

标签: ruby instance-variables step

以下代码在最后一行返回错误(TypeError: no implicit conversion of nil into String)

And(/^the user makes the following changes in the response file "(.*)" and creates a uri with "(.*)" and wskey:$/) do |readFile, strURI,table|

  strRequestBody = $objFileIO.ReadFile(STR_FILE_SPEC + '/response/' + readFile)
  table.hashes.each do |rows|
    @request_uri = strRequestBody.gsub!(/#{rows[:parameter_in_response]}/, rows[:replace_with])
  end

  puts "this is url" + @request_uri   
end

1 个答案:

答案 0 :(得分:0)

只需在循环外定义它,然后瓢将更改。