From 35dcdaf461df58e6eaabb1703617d9efd632cabd Mon Sep 17 00:00:00 2001 From: Junichi Sato <22004610+sato11@users.noreply.github.com> Date: Mon, 4 Mar 2024 11:18:43 +0900 Subject: [PATCH] Define a missing method #root for the development configurator This fixes an unexpected NoMethodError that experimenting through `bin/console` causes: ``` irb(main):001> Kredis.string "mystring" /rails/kredis/lib/kredis/connections.rb:15:in `block in configured_for': undefined method `root' for an instance of # (NoMethodError) if configurator.root.join("config/redis/#{name}.yml").exist? ^^^^^ ``` This is a follow-up to https://github.com/rails/kredis/pull/135. --- bin/console | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/console b/bin/console index 4300bda..0daa287 100755 --- a/bin/console +++ b/bin/console @@ -14,7 +14,10 @@ end require "debug" -Kredis.configurator = Class.new { def config_for(name) { db: "2" } end }.new +Kredis.configurator = Class.new do + def config_for(name) { db: "2" } end + def root() Pathname.new(".") end +end.new ActiveSupport::LogSubscriber.logger = ActiveSupport::Logger.new(STDOUT) IRB.start