lib/lhj/command/yapi.rb in lhj-tools-0.1.85 vs lib/lhj/command/yapi.rb in lhj-tools-0.1.86
- old
+ new
@@ -122,10 +122,10 @@
req_mock_file = File.join('.', sub_folder_name, "#{model_pre}#{name}Mock.m")
File.write(h_file, @h_file_array.join("\n")) if @h_file_array.count.positive?
File.write(m_file, @m_file_array.join("\n")) if @m_file_array.count.positive?
File.write(service_file, service_code) if service_code
- File.write(req_mock_file, @req_mock_array.join("\n")) if @req_mock_array.count.positive?
+ File.write(req_mock_file, @req_mock_array.join("\n")) if @req_mock_array&.count&.positive?
puts "\n\n生成文件成功!所在路径:\n#{File.expand_path(h_file)} \n#{File.expand_path(m_file)}".green if @save && !@notify
{
h_file: "#{sub_folder_name}/#{file_name}.h",
m_file: "#{sub_folder_name}/#{file_name}.m",