mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Use class methods scope now that we have multiple
This commit is contained in:
parent
41afdb62f1
commit
01109dc003
1 changed files with 16 additions and 14 deletions
|
@ -35,21 +35,23 @@ class ActiveStorage::Service
|
||||||
extend ActiveSupport::Autoload
|
extend ActiveSupport::Autoload
|
||||||
autoload :Configurator
|
autoload :Configurator
|
||||||
|
|
||||||
# Configure an Active Storage service by name from a set of configurations,
|
class << self
|
||||||
# typically loaded from a YAML file. The Active Storage engine uses this
|
# Configure an Active Storage service by name from a set of configurations,
|
||||||
# to set the global Active Storage service when the app boots.
|
# typically loaded from a YAML file. The Active Storage engine uses this
|
||||||
def self.configure(service_name, configurations)
|
# to set the global Active Storage service when the app boots.
|
||||||
Configurator.build(service_name, configurations)
|
def configure(service_name, configurations)
|
||||||
end
|
Configurator.build(service_name, configurations)
|
||||||
|
end
|
||||||
|
|
||||||
# Override in subclasses that stitch together multiple services and hence
|
# Override in subclasses that stitch together multiple services and hence
|
||||||
# need to build additional services using the configurator.
|
# need to build additional services using the configurator.
|
||||||
#
|
#
|
||||||
# Passes the configurator and all of the service's config as keyword args.
|
# Passes the configurator and all of the service's config as keyword args.
|
||||||
#
|
#
|
||||||
# See MirrorService for an example.
|
# See MirrorService for an example.
|
||||||
def self.build(configurator:, service: nil, **service_config) #:nodoc:
|
def build(configurator:, service: nil, **service_config) #:nodoc:
|
||||||
new(**service_config)
|
new(**service_config)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def upload(key, io, checksum: nil)
|
def upload(key, io, checksum: nil)
|
||||||
|
|
Loading…
Reference in a new issue