From 77b61513644c01a433ddfe8a4d264e2144b87ed4 Mon Sep 17 00:00:00 2001 From: Brusk Awat Date: Thu, 1 Dec 2022 18:41:10 +0300 Subject: [PATCH] Constantizes string --- Gemfile.lock | 2 +- lib/rabbit_carrots/tasks/rmq.rake | 5 ++++- lib/rabbit_carrots/version.rb | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index c687df8..da67f7a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - rabbit_carrots (0.1.3) + rabbit_carrots (0.1.4) activesupport (>= 6.0.0) bunny (>= 2.19.0) connection_pool (~> 2.3.0) diff --git a/lib/rabbit_carrots/tasks/rmq.rake b/lib/rabbit_carrots/tasks/rmq.rake index 6754813..55519c9 100644 --- a/lib/rabbit_carrots/tasks/rmq.rake +++ b/lib/rabbit_carrots/tasks/rmq.rake @@ -5,7 +5,10 @@ namespace :rmq do task subscriber: :environment do Rails.application.eager_load! - channels = RabbitCarrots::Configuration.routing_key_mappings + channels = RabbitCarrots::Configuration.routing_key_mappings.map do |mapping| + # This will be supplied in initializer. At that time, the Handler will not be available to be loaded and will throw Uninitialized Constant + { **mapping, handler_class: mapping[:handler_class].constantize } + end Rails.logger = Logger.new($stdout) diff --git a/lib/rabbit_carrots/version.rb b/lib/rabbit_carrots/version.rb index be34e0b..64d7d64 100644 --- a/lib/rabbit_carrots/version.rb +++ b/lib/rabbit_carrots/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module RabbitCarrots - VERSION = "0.1.3" + VERSION = "0.1.4" end