mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
avoid set of too many instance variables via Proc/local.
This commit is contained in:
parent
185004ec68
commit
c0dd290d4f
1 changed files with 3 additions and 5 deletions
|
@ -51,12 +51,10 @@ class Pry::Config::Default < Pry::Config
|
|||
|
||||
state.each do |key, value|
|
||||
define_method(key) do
|
||||
ivar = "@#{key}"
|
||||
if instance_variable_defined?(ivar)
|
||||
return instance_variable_get(ivar)
|
||||
else
|
||||
instance_variable_set(ivar, value.call)
|
||||
if state[key] == value
|
||||
state[key] = value.call
|
||||
end
|
||||
state[key]
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue