about summary refs log tree commit homepage
path: root/lib/PublicInbox/Search.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-06-14 17:13:04 +0000
committerEric Wong <e@80x24.org>2019-06-14 17:27:10 +0000
commit20ddcb02821ff3bf8afd2c2279e0889492c93fd9 (patch)
tree8f9af12f09b4df05594ca916057f54dd48728ecc /lib/PublicInbox/Search.pm
parent585314673236d664729fe3ab2d4fb229d1c0f2d5 (diff)
downloadpublic-inbox-20ddcb02821ff3bf8afd2c2279e0889492c93fd9.tar.gz
No sense in supporting multiple methods of initialization
for an internal class.
Diffstat (limited to 'lib/PublicInbox/Search.pm')
-rw-r--r--lib/PublicInbox/Search.pm15
1 files changed, 5 insertions, 10 deletions
diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm
index 9903f427..098c97cd 100644
--- a/lib/PublicInbox/Search.pm
+++ b/lib/PublicInbox/Search.pm
@@ -170,17 +170,12 @@ sub xdb ($) {
 }
 
 sub new {
-        my ($class, $mainrepo, $altid) = @_;
-        my $version = 1;
-        my $ibx = $mainrepo;
-        if (ref $ibx) {
-                $version = $ibx->{version} || 1;
-                $mainrepo = $ibx->{mainrepo};
-        }
+        my ($class, $ibx) = @_;
+        ref $ibx or die "BUG: expected PublicInbox::Inbox object: $ibx";
         my $self = bless {
-                mainrepo => $mainrepo,
-                altid => $altid,
-                version => $version,
+                mainrepo => $ibx->{mainrepo},
+                altid => $ibx->{altid},
+                version => $ibx->{version} // 1,
         }, $class;
         my $dir = xdir($self, 1);
         $self->{over_ro} = PublicInbox::Over->new("$dir/over.sqlite3");