diff options
author | Cristian Bica <cristian.bica@gmail.com> | 2017-07-14 01:09:56 +0300 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2017-07-14 00:09:56 +0200 |
commit | 6dcdc5c9abb8e4e93a2c582b11ff4bb77d62ed3b (patch) | |
tree | ad3bdb1e754d6207df0656d2704ae82b36c785cb /lib | |
parent | 14e6386b3ceb0ab1d13ddd1353722d56785f9007 (diff) | |
download | rails-6dcdc5c9abb8e4e93a2c582b11ff4bb77d62ed3b.tar.gz rails-6dcdc5c9abb8e4e93a2c582b11ff4bb77d62ed3b.tar.bz2 rails-6dcdc5c9abb8e4e93a2c582b11ff4bb77d62ed3b.zip |
Added rubocop / codeclimate config and fixed current offenses (#45)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/active_storage/disk_controller.rb | 2 | ||||
-rw-r--r-- | lib/active_storage/download.rb | 6 | ||||
-rw-r--r-- | lib/active_storage/service.rb | 2 | ||||
-rw-r--r-- | lib/active_storage/service/disk_service.rb | 2 | ||||
-rw-r--r-- | lib/active_storage/service/s3_service.rb | 8 | ||||
-rw-r--r-- | lib/active_storage/verified_key_with_expiration.rb | 2 | ||||
-rw-r--r-- | lib/tasks/activestorage.rake | 2 |
7 files changed, 12 insertions, 12 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) diff --git a/lib/tasks/activestorage.rake b/lib/tasks/activestorage.rake index 17dab0854a..ea83707224 100644 --- a/lib/tasks/activestorage.rake +++ b/lib/tasks/activestorage.rake @@ -7,7 +7,7 @@ namespace :activestorage do FileUtils.mkdir_p Rails.root.join("tmp/storage") puts "Made storage and tmp/storage directories for development and testing" - FileUtils.cp File.expand_path("../../active_storage/storage_services.yml", __FILE__), Rails.root.join("config") + FileUtils.cp File.expand_path("../../active_storage/storage_services.yml", __FILE__), Rails.root.join("config") puts "Copied default configuration to config/storage_services.yml" migration_file_path = "db/migrate/#{Time.now.utc.strftime("%Y%m%d%H%M%S")}_active_storage_create_tables.rb" |