diff options
author | Eric Wong <e@80x24.org> | 2016-05-15 06:31:49 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2016-05-16 02:55:58 +0000 |
commit | f22bbb56cf44c6864d53cf27746f9cafc12e05c1 (patch) | |
tree | c24ace20a79120b2b7078c42c24aca82dc05a6d2 /lib | |
parent | 48b21cb662c1e17b7219612bff6ea14b98c85221 (diff) | |
download | public-inbox-f22bbb56cf44c6864d53cf27746f9cafc12e05c1.tar.gz |
This should make creating test cases easier and faster.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/PublicInbox/Config.pm | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm index 3f3707ec..b5f0fcb1 100644 --- a/lib/PublicInbox/Config.pm +++ b/lib/PublicInbox/Config.pm @@ -15,9 +15,12 @@ use File::Path::Expand qw/expand_filename/; sub new { my ($class, $file) = @_; $file = default_file() unless defined($file); - my $self = bless git_config_dump($file), $class; - $self->{-by_addr} = {}; - $self->{-by_name} = {}; + $file = ref $file ? $file : git_config_dump($file); + my $self = bless $file, $class; + + # caches + $self->{-by_addr} ||= {}; + $self->{-by_name} ||= {}; $self; } |