Skip to content

Commit 126e5d6

Browse files
小野 直人ko1
authored andcommitted
Make the instance variable named @content a local variable
1 parent 1ddd04b commit 126e5d6

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

test/tool/test_builder.rb

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,21 +191,19 @@ def program
191191
def create_file
192192
path = "#{__dir__}/../debug/#{@class.sub(/(?i:t)est/, '').downcase}_test.rb"
193193
if File.exist?(path)
194-
File.open(path, 'r') do |f|
195-
lines = f.read
196-
@content = lines.split("\n")[0..-3].join("\n") + "\n#{create_scenario} end\nend\n" if lines.include? @class
197-
end
194+
lines = File.read(path)
195+
content = lines.split("\n")[0..-3].join("\n") + "\n#{create_scenario} end\nend\n" if lines.include? @class
198196
end
199-
if @content
197+
if content
200198
puts "appended: #{path}"
201199
else
202-
@content = content_with_module
200+
content = content_with_module
203201
puts "created: #{path}"
204202
puts " class: #{@class}"
205203
end
206204
puts " method: #{@method}"
207205

208-
File.write(path, @content)
206+
File.write(path, content)
209207
end
210208

211209
def remove_temp_file

0 commit comments

Comments
 (0)