fix 'at least one lazy method has to be called before #lazy_keys could ..'

This commit is contained in:
strcmp 2015-12-31 16:02:34 -08:00
parent f95d65171e
commit c584d173a1
2 changed files with 1 additions and 2 deletions

View File

@ -6,12 +6,12 @@ module Pry::Config::Lazy
method_name_to_func.each do |method_name, func|
define_method(method_name) do
if method_name_to_func[method_name].equal?(func)
LAZY_KEYS[self.class] |= method_name_to_func.keys
method_name_to_func[method_name] = instance_eval(&func)
end
method_name_to_func[method_name]
end
end
LAZY_KEYS[self] |= method_name_to_func.keys
end
end

View File

@ -15,7 +15,6 @@ RSpec.describe Pry::Config::Lazy do
describe "#lazy_keys" do
it "tracks a list of lazy keys" do
lazyobj.foo # at least one lazy method has to be called before #lazy_keys could return a non-empty array.
expect(lazyobj.lazy_keys).to eq([:foo, :bar])
end
end