From d02844f2499be488d262bc274530ec44e242fd70 Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Sat, 12 Aug 2017 21:32:15 +0900 Subject: Use frozen string literal in Active Storage --- activestorage/lib/active_storage.rb | 2 ++ activestorage/lib/active_storage/attached.rb | 2 ++ activestorage/lib/active_storage/attached/macros.rb | 2 ++ activestorage/lib/active_storage/attached/many.rb | 2 ++ activestorage/lib/active_storage/attached/one.rb | 2 ++ activestorage/lib/active_storage/gem_version.rb | 2 ++ activestorage/lib/active_storage/log_subscriber.rb | 4 +++- activestorage/lib/active_storage/service.rb | 2 ++ activestorage/lib/active_storage/service/azure_storage_service.rb | 2 ++ activestorage/lib/active_storage/service/configurator.rb | 2 ++ activestorage/lib/active_storage/service/disk_service.rb | 2 ++ activestorage/lib/active_storage/service/gcs_service.rb | 2 ++ activestorage/lib/active_storage/service/mirror_service.rb | 2 ++ activestorage/lib/active_storage/service/s3_service.rb | 2 ++ activestorage/lib/active_storage/version.rb | 2 ++ activestorage/lib/tasks/activestorage.rake | 2 ++ 16 files changed, 33 insertions(+), 1 deletion(-) (limited to 'activestorage/lib') diff --git a/activestorage/lib/active_storage.rb b/activestorage/lib/active_storage.rb index 412f08e8f5..ccc1d4a163 100644 --- a/activestorage/lib/active_storage.rb +++ b/activestorage/lib/active_storage.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + #-- # Copyright (c) 2017 David Heinemeier Hansson # diff --git a/activestorage/lib/active_storage/attached.rb b/activestorage/lib/active_storage/attached.rb index f11b62e744..e90b75afd0 100644 --- a/activestorage/lib/active_storage/attached.rb +++ b/activestorage/lib/active_storage/attached.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "action_dispatch" require "action_dispatch/http/upload" require "active_support/core_ext/module/delegation" diff --git a/activestorage/lib/active_storage/attached/macros.rb b/activestorage/lib/active_storage/attached/macros.rb index eb877f10c0..027112195f 100644 --- a/activestorage/lib/active_storage/attached/macros.rb +++ b/activestorage/lib/active_storage/attached/macros.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ActiveStorage # Provides the class-level DSL for declaring that an Active Record model has attached blobs. module Attached::Macros diff --git a/activestorage/lib/active_storage/attached/many.rb b/activestorage/lib/active_storage/attached/many.rb index cc3e70ffe2..59b7d7d559 100644 --- a/activestorage/lib/active_storage/attached/many.rb +++ b/activestorage/lib/active_storage/attached/many.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ActiveStorage # Decorated proxy object representing of multiple attachments to a model. class Attached::Many < Attached diff --git a/activestorage/lib/active_storage/attached/one.rb b/activestorage/lib/active_storage/attached/one.rb index 6b34b30f1c..2e5831348e 100644 --- a/activestorage/lib/active_storage/attached/one.rb +++ b/activestorage/lib/active_storage/attached/one.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ActiveStorage # Representation of a single attachment to a model. class Attached::One < Attached diff --git a/activestorage/lib/active_storage/gem_version.rb b/activestorage/lib/active_storage/gem_version.rb index db79c669bf..bb6241ae47 100644 --- a/activestorage/lib/active_storage/gem_version.rb +++ b/activestorage/lib/active_storage/gem_version.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ActiveStorage # Returns the version of the currently loaded Active Storage as a Gem::Version def self.gem_version diff --git a/activestorage/lib/active_storage/log_subscriber.rb b/activestorage/lib/active_storage/log_subscriber.rb index 5c1b8d23ef..80cc5d5c80 100644 --- a/activestorage/lib/active_storage/log_subscriber.rb +++ b/activestorage/lib/active_storage/log_subscriber.rb @@ -1,10 +1,12 @@ +# frozen_string_literal: true + require "active_support/log_subscriber" module ActiveStorage class LogSubscriber < ActiveSupport::LogSubscriber def service_upload(event) message = "Uploaded file to key: #{key_in(event)}" - message << " (checksum: #{event.payload[:checksum]})" if event.payload[:checksum] + message += " (checksum: #{event.payload[:checksum]})" if event.payload[:checksum] info event, color(message, GREEN) end diff --git a/activestorage/lib/active_storage/service.rb b/activestorage/lib/active_storage/service.rb index 4dd6eb6045..ce736b8728 100644 --- a/activestorage/lib/active_storage/service.rb +++ b/activestorage/lib/active_storage/service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "active_storage/log_subscriber" module ActiveStorage diff --git a/activestorage/lib/active_storage/service/azure_storage_service.rb b/activestorage/lib/active_storage/service/azure_storage_service.rb index d1c62f7db1..d066deaa20 100644 --- a/activestorage/lib/active_storage/service/azure_storage_service.rb +++ b/activestorage/lib/active_storage/service/azure_storage_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "active_support/core_ext/numeric/bytes" require "azure/storage" require "azure/storage/core/auth/shared_access_signature" diff --git a/activestorage/lib/active_storage/service/configurator.rb b/activestorage/lib/active_storage/service/configurator.rb index 5d6475a8ae..39951fd026 100644 --- a/activestorage/lib/active_storage/service/configurator.rb +++ b/activestorage/lib/active_storage/service/configurator.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ActiveStorage class Service::Configurator #:nodoc: attr_reader :configurations diff --git a/activestorage/lib/active_storage/service/disk_service.rb b/activestorage/lib/active_storage/service/disk_service.rb index 9498761cc5..cf4019966f 100644 --- a/activestorage/lib/active_storage/service/disk_service.rb +++ b/activestorage/lib/active_storage/service/disk_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "fileutils" require "pathname" require "digest/md5" diff --git a/activestorage/lib/active_storage/service/gcs_service.rb b/activestorage/lib/active_storage/service/gcs_service.rb index 0707f26a74..32dfb4851b 100644 --- a/activestorage/lib/active_storage/service/gcs_service.rb +++ b/activestorage/lib/active_storage/service/gcs_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "google/cloud/storage" require "active_support/core_ext/object/to_query" diff --git a/activestorage/lib/active_storage/service/mirror_service.rb b/activestorage/lib/active_storage/service/mirror_service.rb index 8491df4911..39e922f7ab 100644 --- a/activestorage/lib/active_storage/service/mirror_service.rb +++ b/activestorage/lib/active_storage/service/mirror_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "active_support/core_ext/module/delegation" module ActiveStorage diff --git a/activestorage/lib/active_storage/service/s3_service.rb b/activestorage/lib/active_storage/service/s3_service.rb index b25eb409ef..98c9dd2972 100644 --- a/activestorage/lib/active_storage/service/s3_service.rb +++ b/activestorage/lib/active_storage/service/s3_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "aws-sdk" require "active_support/core_ext/numeric/bytes" diff --git a/activestorage/lib/active_storage/version.rb b/activestorage/lib/active_storage/version.rb index 8f45480712..4b6631832b 100644 --- a/activestorage/lib/active_storage/version.rb +++ b/activestorage/lib/active_storage/version.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require_relative "gem_version" module ActiveStorage diff --git a/activestorage/lib/tasks/activestorage.rake b/activestorage/lib/tasks/activestorage.rake index 7a573be596..746bc5b28a 100644 --- a/activestorage/lib/tasks/activestorage.rake +++ b/activestorage/lib/tasks/activestorage.rake @@ -1,3 +1,5 @@ +# frozen_string_literal: true + namespace :activestorage do desc "Copy over the migration needed to the application" task install: :environment do -- cgit v1.2.3