1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

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