aboutsummaryrefslogtreecommitdiffstats
path: root/lib/active_storage
diff options
context:
space:
mode:
authorCristian Bica <cristian.bica@gmail.com>2017-07-14 01:09:56 +0300
committerDavid Heinemeier Hansson <david@loudthinking.com>2017-07-14 00:09:56 +0200
commit6dcdc5c9abb8e4e93a2c582b11ff4bb77d62ed3b (patch)
treead3bdb1e754d6207df0656d2704ae82b36c785cb /lib/active_storage
parent14e6386b3ceb0ab1d13ddd1353722d56785f9007 (diff)
downloadrails-6dcdc5c9abb8e4e93a2c582b11ff4bb77d62ed3b.tar.gz
rails-6dcdc5c9abb8e4e93a2c582b11ff4bb77d62ed3b.tar.bz2
rails-6dcdc5c9abb8e4e93a2c582b11ff4bb77d62ed3b.zip
Added rubocop / codeclimate config and fixed current offenses (#45)
Diffstat (limited to 'lib/active_storage')
-rw-r--r--lib/active_storage/disk_controller.rb2
-rw-r--r--lib/active_storage/download.rb6
-rw-r--r--lib/active_storage/service.rb2
-rw-r--r--lib/active_storage/service/disk_service.rb2
-rw-r--r--lib/active_storage/service/s3_service.rb8
-rw-r--r--lib/active_storage/verified_key_with_expiration.rb2
6 files changed, 11 insertions, 11 deletions
diff --git a/lib/active_storage/disk_controller.rb b/lib/active_storage/disk_controller.rb
index 7149cc17a6..16a295d00d 100644
--- a/lib/active_storage/disk_controller.rb
+++ b/lib/active_storage/disk_controller.rb
@@ -33,6 +33,6 @@ class ActiveStorage::DiskController < ActionController::Base
end
def disposition_param
- params[:disposition].presence_in(%w( inline attachment )) || 'inline'
+ params[:disposition].presence_in(%w( inline attachment )) || "inline"
end
end
diff --git a/lib/active_storage/download.rb b/lib/active_storage/download.rb
index 4d656942d8..6040a32de9 100644
--- a/lib/active_storage/download.rb
+++ b/lib/active_storage/download.rb
@@ -14,7 +14,7 @@ class ActiveStorage::Download
application/xhtml+xml
)
- BINARY_CONTENT_TYPE = 'application/octet-stream'
+ BINARY_CONTENT_TYPE = "application/octet-stream"
def initialize(stored_file)
@stored_file = stored_file
@@ -22,11 +22,11 @@ class ActiveStorage::Download
def headers(force_attachment: false)
{
- x_accel_redirect: '/reproxy',
+ x_accel_redirect: "/reproxy",
x_reproxy_url: reproxy_url,
content_type: content_type,
content_disposition: content_disposition(force_attachment),
- x_frame_options: 'SAMEORIGIN'
+ x_frame_options: "SAMEORIGIN"
}
end
diff --git a/lib/active_storage/service.rb b/lib/active_storage/service.rb
index d0d4362006..cba9cd9c83 100644
--- a/lib/active_storage/service.rb
+++ b/lib/active_storage/service.rb
@@ -85,7 +85,7 @@ class ActiveStorage::Service
private
def instrument(operation, key, payload = {}, &block)
ActiveSupport::Notifications.instrument(
- "service_#{operation}.active_storage",
+ "service_#{operation}.active_storage",
payload.merge(key: key, service: service_name), &block)
end
diff --git a/lib/active_storage/service/disk_service.rb b/lib/active_storage/service/disk_service.rb
index 7e64e1e909..a2a27528c1 100644
--- a/lib/active_storage/service/disk_service.rb
+++ b/lib/active_storage/service/disk_service.rb
@@ -20,7 +20,7 @@ class ActiveStorage::Service::DiskService < ActiveStorage::Service
def download(key)
if block_given?
instrument :streaming_download, key do
- File.open(path_for(key), 'rb') do |file|
+ File.open(path_for(key), "rb") do |file|
while data = file.read(64.kilobytes)
yield data
end
diff --git a/lib/active_storage/service/s3_service.rb b/lib/active_storage/service/s3_service.rb
index c3b6688bb9..e75ac36c7d 100644
--- a/lib/active_storage/service/s3_service.rb
+++ b/lib/active_storage/service/s3_service.rb
@@ -49,9 +49,9 @@ class ActiveStorage::Service::S3Service < ActiveStorage::Service
instrument :url, key do |payload|
generated_url = object_for(key).presigned_url :get, expires_in: expires_in,
response_content_disposition: "#{disposition}; filename=\"#{filename}\""
-
+
payload[:url] = generated_url
-
+
generated_url
end
end
@@ -60,9 +60,9 @@ class ActiveStorage::Service::S3Service < ActiveStorage::Service
instrument :url, key do |payload|
generated_url = object_for(key).presigned_url :put, expires_in: expires_in,
content_type: content_type, content_length: content_length
-
+
payload[:url] = generated_url
-
+
generated_url
end
end
diff --git a/lib/active_storage/verified_key_with_expiration.rb b/lib/active_storage/verified_key_with_expiration.rb
index 8708106735..e429ee21ce 100644
--- a/lib/active_storage/verified_key_with_expiration.rb
+++ b/lib/active_storage/verified_key_with_expiration.rb
@@ -1,5 +1,5 @@
class ActiveStorage::VerifiedKeyWithExpiration
- class_attribute :verifier, default: defined?(Rails) ? Rails.application.message_verifier('ActiveStorage') : nil
+ class_attribute :verifier, default: defined?(Rails) ? Rails.application.message_verifier("ActiveStorage") : nil
class << self
def encode(key, expires_in: nil)