lib/wcc/contentful/store/factory.rb in wcc-contentful-1.0.8 vs lib/wcc/contentful/store/factory.rb in wcc-contentful-1.1.0
- old
+ new
@@ -73,10 +73,11 @@
middleware_config = [middleware_config] unless middleware_config.is_a? Array
middleware, params, configure_proc = middleware_config
middleware_options = options.merge((params || []).extract_options!)
middleware = middleware.call(memo, *params, **middleware_options)
+ services.inject_into(middleware, except: %i[store preview_store])
middleware&.instance_exec(&configure_proc) if configure_proc
middleware || memo
end
end
@@ -152,15 +153,10 @@
else
store_class.new(config, *options - [store_class])
end
# Inject services into the custom store class
- (WCC::Contentful::SERVICES - %i[store preview_store]).each do |s|
- next unless store.respond_to?("#{s}=")
-
- store.public_send("#{s}=",
- services.public_send(s))
- end
+ services.inject_into(store, except: %i[store preview_store])
store
end
def class_implements_store_interface?(klass)