1
0
Fork 0
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:
Robert Gleeson 2014-01-20 22:44:05 +01:00
parent 185004ec68
commit c0dd290d4f

View file

@ -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