1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Splat options

This commit is contained in:
George Claghorn 2017-07-16 19:17:47 -04:00
parent 2f15938587
commit 94a450acbe

View file

@ -4,22 +4,8 @@ require "active_support/core_ext/numeric/bytes"
class ActiveStorage::Service::S3Service < ActiveStorage::Service class ActiveStorage::Service::S3Service < ActiveStorage::Service
attr_reader :client, :bucket attr_reader :client, :bucket
def initialize(access_key_id:, secret_access_key:, region:, bucket:, endpoint: nil) def initialize(access_key_id:, secret_access_key:, region:, bucket:, **options)
@client = if endpoint @client = Aws::S3::Resource.new(access_key_id: access_key_id, secret_access_key: secret_access_key, region: region, **options)
Aws::S3::Resource.new(
access_key_id: access_key_id,
secret_access_key: secret_access_key,
region: region,
endpoint: endpoint
)
else
Aws::S3::Resource.new(
access_key_id: access_key_id,
secret_access_key: secret_access_key,
region: region
)
end
@bucket = @client.bucket(bucket) @bucket = @client.bucket(bucket)
end end