From 6dcdc5c9abb8e4e93a2c582b11ff4bb77d62ed3b Mon Sep 17 00:00:00 2001 From: Cristian Bica Date: Fri, 14 Jul 2017 01:09:56 +0300 Subject: Added rubocop / codeclimate config and fixed current offenses (#45) --- lib/active_storage/disk_controller.rb | 2 +- lib/active_storage/download.rb | 6 +++--- lib/active_storage/service.rb | 2 +- lib/active_storage/service/disk_service.rb | 2 +- lib/active_storage/service/s3_service.rb | 8 ++++---- lib/active_storage/verified_key_with_expiration.rb | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) (limited to 'lib/active_storage') 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) -- cgit v1.2.3