30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/active_storage_saas/storage_service_configuration_model_mixin.rb', line 30
def to_service
defined_service = ActiveStorage::Blob.services.fetch(service_name)
klass = defined_service.class
options = ActiveStorage::Blob.services.send(:configurations).fetch(service_name.to_sym)
options.deep_merge! service_options.deep_symbolize_keys
klass.new(**options).tap do |instance|
instance.instance_eval <<~RUBY
define_singleton_method(:name) { "#{to_service_name}" }
RUBY
end
end
|