aboutsummaryrefslogtreecommitdiffstats
path: root/lib/active_storage/service.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2017-07-09 14:42:46 +0200
committerDavid Heinemeier Hansson <david@loudthinking.com>2017-07-09 14:42:46 +0200
commit01109dc00357b758c5809708f510bcef6442350b (patch)
tree8ed5cd276ae3bcdffdde34a2dde5840efa3ae9c0 /lib/active_storage/service.rb
parent41afdb62f12e2464bfbda4abccad17e6db053687 (diff)
downloadrails-01109dc00357b758c5809708f510bcef6442350b.tar.gz
rails-01109dc00357b758c5809708f510bcef6442350b.tar.bz2
rails-01109dc00357b758c5809708f510bcef6442350b.zip
Use class methods scope now that we have multiple
Diffstat (limited to 'lib/active_storage/service.rb')
-rw-r--r--lib/active_storage/service.rb30
1 files changed, 16 insertions, 14 deletions
diff --git a/lib/active_storage/service.rb b/lib/active_storage/service.rb
index 021c695a07..86f867c293 100644
--- a/lib/active_storage/service.rb
+++ b/lib/active_storage/service.rb
@@ -35,21 +35,23 @@ class ActiveStorage::Service
extend ActiveSupport::Autoload
autoload :Configurator
- # Configure an Active Storage service by name from a set of configurations,
- # typically loaded from a YAML file. The Active Storage engine uses this
- # to set the global Active Storage service when the app boots.
- def self.configure(service_name, configurations)
- Configurator.build(service_name, configurations)
- end
+ class << self
+ # Configure an Active Storage service by name from a set of configurations,
+ # typically loaded from a YAML file. The Active Storage engine uses this
+ # to set the global Active Storage service when the app boots.
+ def configure(service_name, configurations)
+ Configurator.build(service_name, configurations)
+ end
- # Override in subclasses that stitch together multiple services and hence
- # need to build additional services using the configurator.
- #
- # Passes the configurator and all of the service's config as keyword args.
- #
- # See MirrorService for an example.
- def self.build(configurator:, service: nil, **service_config) #:nodoc:
- new(**service_config)
+ # Override in subclasses that stitch together multiple services and hence
+ # need to build additional services using the configurator.
+ #
+ # Passes the configurator and all of the service's config as keyword args.
+ #
+ # See MirrorService for an example.
+ def build(configurator:, service: nil, **service_config) #:nodoc:
+ new(**service_config)
+ end
end
def upload(key, io, checksum: nil)