From dfa8ef84e9cc4f24b7155572420ad827c70c6ee5 Mon Sep 17 00:00:00 2001 From: Emma Lejeck Date: Sun, 20 Aug 2023 20:16:03 -0700 Subject: [PATCH] Add auto-initialization with default config --- Gemfile.lock | 2 +- lib/typesensual.rb | 8 +++++--- lib/typesensual/version.rb | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index da1e902..16fbde4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - typesensual (0.3.0) + typesensual (0.3.1) activesupport (>= 6.1.5) paint (>= 2.0.0) typesense (>= 0.13.0) diff --git a/lib/typesensual.rb b/lib/typesensual.rb index 4a489aa..12aa9ff 100644 --- a/lib/typesensual.rb +++ b/lib/typesensual.rb @@ -19,14 +19,16 @@ class Typesensual class << self - attr_accessor :config - def client config&.client end def configure(&block) - self.config = Typesensual::Config.new(&block) + @config = Typesensual::Config.new(&block) + end + + def config + @config ||= Typesensual::Config.new end # Get the collections that match the alias name diff --git a/lib/typesensual/version.rb b/lib/typesensual/version.rb index fdff3bc..e180171 100644 --- a/lib/typesensual/version.rb +++ b/lib/typesensual/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true class Typesensual - VERSION = '0.3.0' + VERSION = '0.3.1' end