Skip to content

Commit 091c8cd

Browse files
mamePragTob
authored andcommitted
Prevent an "instance variable not initialized" warning
Under $VERBOSE=true, simplecov emits the following warning: ``` lib/simplecov/configuration.rb:203: warning: instance variable @enable_for_subprocesses not initialized ``` This change suppresses the warning.
1 parent 2eb7b85 commit 091c8cd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/simplecov/configuration.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,9 @@ def at_exit(&block)
199199
# gets or sets the enabled_for_subprocess configuration
200200
# when true, this will inject SimpleCov code into Process.fork
201201
def enable_for_subprocesses(value = nil)
202-
@enable_for_subprocesses = value unless value.nil?
203-
@enable_for_subprocesses || false
202+
return @enable_for_subprocesses if defined?(@enable_for_subprocesses) && value.nil?
203+
204+
@enable_for_subprocesses = value || false
204205
end
205206

206207
# gets the enabled_for_subprocess configuration

0 commit comments

Comments
 (0)