Require the directory argument to Contact.all
The default hid a config read in the signature; web.rb, the only
caller that relied on it, now passes it explicitly.
Assisted-by: GLM-5.3 via pi
diff --git a/lib/pro_tacts/contact.rb b/lib/pro_tacts/contact.rb
index 1998f3e..9f47cbf 100644
--- a/lib/pro_tacts/contact.rb
+++ b/lib/pro_tacts/contact.rb
@@ -1,7 +1,6 @@
require "kdl"
require "pathname"
-require "pro_tacts"
require "pro_tacts/vcard"
module ProTacts
@@ -19,7 +18,7 @@ module ProTacts
# else raises: a bad file 500s the request and lands in Sentry
# rather than quietly serving a partial address book. A missing
# directory surfaces as Errno::ENOENT from Pathname#children.
- def self.all(directory = ProTacts.config.contacts_dir)
+ def self.all(directory)
Pathname.new(directory).children
.reject { it.basename.to_s.start_with?(".") }
.map { parse(it) }
diff --git a/lib/pro_tacts/web.rb b/lib/pro_tacts/web.rb
index b4447f8..c10e12d 100644
--- a/lib/pro_tacts/web.rb
+++ b/lib/pro_tacts/web.rb
@@ -249,7 +249,7 @@ module ProTacts
# one — with the directory coming from config. Caching belongs with
# real etags.
def contacts
- @contacts ||= Contact.all
+ @contacts ||= Contact.all(ProTacts.config.contacts_dir)
end
def contact_href(id)