Skip to content

Commit

Permalink
Always initialize @default and @default_block for AbstractThreadLocalVar
Browse files Browse the repository at this point in the history
This avoids Ruby warnings like this when accessing the default value:

> lib/concurrent/atomic/abstract_thread_local_var.rb:57: warning: instance variable @default_block not initialized
  • Loading branch information
meineerde committed Feb 7, 2017
1 parent 2a8a589 commit 0d5a11b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/concurrent/atomic/abstract_thread_local_var.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ def initialize(default = nil, &default_block)

if block_given?
@default_block = default_block
@default = nil
else
@default_block = nil
@default = default
end

Expand Down

0 comments on commit 0d5a11b

Please sign in to comment.