From 1a17cfb9d9719c8458fb1259371c173627b96d8f Mon Sep 17 00:00:00 2001 From: Jeremy Daer Date: Sun, 9 Jul 2017 03:19:55 -0700 Subject: [PATCH] Service: clarify Service.build arguments First arg is config for the service we're instantiating. Second arg is service configurations so we can look up and configure other services by name. --- lib/active_storage/service.rb | 4 ++-- lib/active_storage/service/mirror_service.rb | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/active_storage/service.rb b/lib/active_storage/service.rb index 1a6a55739f..6978ce6429 100644 --- a/lib/active_storage/service.rb +++ b/lib/active_storage/service.rb @@ -39,8 +39,8 @@ class ActiveStorage::Service # Override in subclasses that stitch together multiple services and hence # need to do additional lookups from configurations. See MirrorService. - def self.build(config, configurations) #:nodoc: - new(config) + def self.build(service_config, all_configurations) #:nodoc: + new(service_config) end def upload(key, io, checksum: nil) diff --git a/lib/active_storage/service/mirror_service.rb b/lib/active_storage/service/mirror_service.rb index eec1f2af65..8a51a75684 100644 --- a/lib/active_storage/service/mirror_service.rb +++ b/lib/active_storage/service/mirror_service.rb @@ -6,10 +6,10 @@ class ActiveStorage::Service::MirrorService < ActiveStorage::Service delegate :download, :exist?, :url, to: :primary # Stitch together from named configuration. - def self.build(mirror_config, all_configurations) #:nodoc: - primary = ActiveStorage::Service.configure(mirror_config.fetch(:primary), all_configurations) + def self.build(service_config, all_configurations) #:nodoc: + primary = ActiveStorage::Service.configure(service_config.fetch(:primary), all_configurations) - mirrors = mirror_config.fetch(:mirrors).collect do |service_name| + mirrors = service_config.fetch(:mirrors).collect do |service_name| ActiveStorage::Service.configure(service_name.to_sym, all_configurations) end