From c584d173a1f880d248e6c478fa8a5580f926f2fa Mon Sep 17 00:00:00 2001 From: strcmp <28xdb6+fvutuvy4f@grr.la> Date: Thu, 31 Dec 2015 16:02:34 -0800 Subject: [PATCH] fix 'at least one lazy method has to be called before #lazy_keys could ..' --- lib/pry/config/lazy.rb | 2 +- spec/config/lazy_spec.rb | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/pry/config/lazy.rb b/lib/pry/config/lazy.rb index 59c705fc..9c44e65c 100644 --- a/lib/pry/config/lazy.rb +++ b/lib/pry/config/lazy.rb @@ -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 diff --git a/spec/config/lazy_spec.rb b/spec/config/lazy_spec.rb index 69884f20..89ae9a27 100644 --- a/spec/config/lazy_spec.rb +++ b/spec/config/lazy_spec.rb @@ -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