lib/kredis/railtie.rb in kredis-0.2.2 vs lib/kredis/railtie.rb in kredis-0.2.3
- old
+ new
@@ -1,33 +1,29 @@
-require "rails/railtie"
+class Kredis::Railtie < ::Rails::Railtie
+ config.kredis = ActiveSupport::OrderedOptions.new
-module Kredis
- class Railtie < ::Rails::Railtie
- config.kredis = ActiveSupport::OrderedOptions.new
-
- initializer "kredis.testing" do
- ActiveSupport.on_load(:active_support_test_case) do
- parallelize_setup { |worker| Kredis.namespace = "test-#{worker}" }
- teardown { Kredis.clear_all }
- end
+ initializer "kredis.testing" do
+ ActiveSupport.on_load(:active_support_test_case) do
+ parallelize_setup { |worker| Kredis.namespace = "test-#{worker}" }
+ teardown { Kredis.clear_all }
end
+ end
- initializer "kredis.logger" do
- Kredis.logger = config.kredis.logger || Rails.logger
- end
+ initializer "kredis.logger" do
+ Kredis.logger = config.kredis.logger || Rails.logger
+ end
- initializer "kredis.configurator" do
- Kredis.configurator = Rails.application
+ initializer "kredis.configurator" do
+ Kredis.configurator = Rails.application
+ end
+
+ initializer "kredis.attributes" do
+ # No load hook for Active Model, just defer until after initialization.
+ config.after_initialize do
+ ActiveModel::Model.include Kredis::Attributes if defined?(ActiveModel::Model)
end
- initializer "kredis.attributes" do
- # No load hook for Active Model, just defer until after initialization.
- config.after_initialize do
- ActiveModel::Model.include Kredis::Attributes if defined?(ActiveModel::Model)
- end
-
- ActiveSupport.on_load(:active_record) do
- include Kredis::Attributes
- end
+ ActiveSupport.on_load(:active_record) do
+ include Kredis::Attributes
end
end
end