diff options
author | Xavier Noria <fxn@hashref.com> | 2016-08-06 19:01:31 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2016-08-06 19:01:31 +0200 |
commit | c3e7abddfb759eecb30cd59f27103fda4c4827dc (patch) | |
tree | bf78c34c03456e017cd463963dccbd6f3ee43172 /actionmailer/lib | |
parent | 35b3de8021e68649cac963bd82a74cc75d1f60f0 (diff) | |
download | rails-c3e7abddfb759eecb30cd59f27103fda4c4827dc.tar.gz rails-c3e7abddfb759eecb30cd59f27103fda4c4827dc.tar.bz2 rails-c3e7abddfb759eecb30cd59f27103fda4c4827dc.zip |
applies new string literal convention in actionmailer/lib
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
Diffstat (limited to 'actionmailer/lib')
-rw-r--r-- | actionmailer/lib/action_mailer.rb | 18 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/base.rb | 20 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/collector.rb | 6 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/delivery_job.rb | 2 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/delivery_methods.rb | 8 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/inline_preview_interceptor.rb | 2 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/log_subscriber.rb | 4 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/mail_helper.rb | 2 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/message_delivery.rb | 2 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/preview.rb | 4 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/railtie.rb | 8 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/test_case.rb | 8 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/test_helper.rb | 2 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/version.rb | 2 | ||||
-rw-r--r-- | actionmailer/lib/rails/generators/mailer/mailer_generator.rb | 6 |
15 files changed, 47 insertions, 47 deletions
diff --git a/actionmailer/lib/action_mailer.rb b/actionmailer/lib/action_mailer.rb index 55c017e338..668bc99435 100644 --- a/actionmailer/lib/action_mailer.rb +++ b/actionmailer/lib/action_mailer.rb @@ -21,15 +21,15 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #++ -require 'abstract_controller' -require 'action_mailer/version' +require "abstract_controller" +require "action_mailer/version" # Common Active Support usage in Action Mailer -require 'active_support/rails' -require 'active_support/core_ext/class' -require 'active_support/core_ext/module/attr_internal' -require 'active_support/core_ext/string/inflections' -require 'active_support/lazy_load_hooks' +require "active_support/rails" +require "active_support/core_ext/class" +require "active_support/core_ext/module/attr_internal" +require "active_support/core_ext/string/inflections" +require "active_support/lazy_load_hooks" module ActionMailer extend ::ActiveSupport::Autoload @@ -43,14 +43,14 @@ module ActionMailer autoload :InlinePreviewInterceptor autoload :MailHelper autoload :Preview - autoload :Previews, 'action_mailer/preview' + autoload :Previews, "action_mailer/preview" autoload :TestCase autoload :TestHelper autoload :MessageDelivery autoload :DeliveryJob end -autoload :Mime, 'action_dispatch/http/mime_type' +autoload :Mime, "action_dispatch/http/mime_type" ActiveSupport.on_load(:action_view) do ActionView::Base.default_formats ||= Mime::SET.symbols diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 0f7c3b54e9..315321620b 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -1,11 +1,11 @@ -require 'mail' -require 'action_mailer/collector' -require 'active_support/core_ext/string/inflections' -require 'active_support/core_ext/hash/except' -require 'active_support/core_ext/module/anonymous' +require "mail" +require "action_mailer/collector" +require "active_support/core_ext/string/inflections" +require "active_support/core_ext/hash/except" +require "active_support/core_ext/module/anonymous" -require 'action_mailer/log_subscriber' -require 'action_mailer/rescuable' +require "action_mailer/log_subscriber" +require "action_mailer/rescuable" module ActionMailer # Action Mailer allows you to send email from your application using a mailer model and views. @@ -598,7 +598,7 @@ module ActionMailer end class NullMail #:nodoc: - def body; '' end + def body; "" end def header; {} end def respond_to?(string, include_all=false) @@ -864,7 +864,7 @@ module ActionMailer # humanized version of the <tt>action_name</tt>. # If the subject has interpolations, you can pass them through the +interpolations+ parameter. def default_i18n_subject(interpolations = {}) - mailer_scope = self.class.mailer_name.tr('/', '.') + mailer_scope = self.class.mailer_name.tr("/", ".") I18n.t(:subject, interpolations.merge(scope: [mailer_scope, action_name], default: action_name.humanize)) end @@ -925,7 +925,7 @@ module ActionMailer def each_template(paths, name, &block) templates = lookup_context.find_all(name, paths) if templates.empty? - raise ActionView::MissingTemplate.new(paths, name, paths, false, 'mailer') + raise ActionView::MissingTemplate.new(paths, name, paths, false, "mailer") else templates.uniq(&:formats).each(&block) end diff --git a/actionmailer/lib/action_mailer/collector.rb b/actionmailer/lib/action_mailer/collector.rb index e8883a8235..d97a73d65a 100644 --- a/actionmailer/lib/action_mailer/collector.rb +++ b/actionmailer/lib/action_mailer/collector.rb @@ -1,6 +1,6 @@ -require 'abstract_controller/collector' -require 'active_support/core_ext/hash/reverse_merge' -require 'active_support/core_ext/array/extract_options' +require "abstract_controller/collector" +require "active_support/core_ext/hash/reverse_merge" +require "active_support/core_ext/array/extract_options" module ActionMailer class Collector diff --git a/actionmailer/lib/action_mailer/delivery_job.rb b/actionmailer/lib/action_mailer/delivery_job.rb index d371c1b61a..a617daa87e 100644 --- a/actionmailer/lib/action_mailer/delivery_job.rb +++ b/actionmailer/lib/action_mailer/delivery_job.rb @@ -1,4 +1,4 @@ -require 'active_job' +require "active_job" module ActionMailer # The <tt>ActionMailer::DeliveryJob</tt> class is used when you diff --git a/actionmailer/lib/action_mailer/delivery_methods.rb b/actionmailer/lib/action_mailer/delivery_methods.rb index c78ff555f3..6be2c91da6 100644 --- a/actionmailer/lib/action_mailer/delivery_methods.rb +++ b/actionmailer/lib/action_mailer/delivery_methods.rb @@ -1,4 +1,4 @@ -require 'tmpdir' +require "tmpdir" module ActionMailer # This module handles everything related to mail delivery, from registering @@ -25,7 +25,7 @@ module ActionMailer add_delivery_method :smtp, Mail::SMTP, address: "localhost", port: 25, - domain: 'localhost.localdomain', + domain: "localhost.localdomain", user_name: nil, password: nil, authentication: nil, @@ -35,8 +35,8 @@ module ActionMailer location: defined?(Rails.root) ? "#{Rails.root}/tmp/mails" : "#{Dir.tmpdir}/mails" add_delivery_method :sendmail, Mail::Sendmail, - location: '/usr/sbin/sendmail', - arguments: '-i' + location: "/usr/sbin/sendmail", + arguments: "-i" add_delivery_method :test, Mail::TestMailer end diff --git a/actionmailer/lib/action_mailer/inline_preview_interceptor.rb b/actionmailer/lib/action_mailer/inline_preview_interceptor.rb index 419d6c7b93..fd9a7bce15 100644 --- a/actionmailer/lib/action_mailer/inline_preview_interceptor.rb +++ b/actionmailer/lib/action_mailer/inline_preview_interceptor.rb @@ -1,4 +1,4 @@ -require 'base64' +require "base64" module ActionMailer # Implements a mailer preview interceptor that converts image tag src attributes diff --git a/actionmailer/lib/action_mailer/log_subscriber.rb b/actionmailer/lib/action_mailer/log_subscriber.rb index 2867bf90fb..2c058ccf66 100644 --- a/actionmailer/lib/action_mailer/log_subscriber.rb +++ b/actionmailer/lib/action_mailer/log_subscriber.rb @@ -1,4 +1,4 @@ -require 'active_support/log_subscriber' +require "active_support/log_subscriber" module ActionMailer # Implements the ActiveSupport::LogSubscriber for logging notifications when @@ -7,7 +7,7 @@ module ActionMailer # An email was delivered. def deliver(event) info do - recipients = Array(event.payload[:to]).join(', ') + recipients = Array(event.payload[:to]).join(", ") "Sent mail to #{recipients} (#{event.duration.round(1)}ms)" end diff --git a/actionmailer/lib/action_mailer/mail_helper.rb b/actionmailer/lib/action_mailer/mail_helper.rb index 239974e7b1..e04fc08866 100644 --- a/actionmailer/lib/action_mailer/mail_helper.rb +++ b/actionmailer/lib/action_mailer/mail_helper.rb @@ -54,7 +54,7 @@ module ActionMailer sentences = [[]] text.split.each do |word| - if sentences.first.present? && (sentences.last + [word]).join(' ').length > len + if sentences.first.present? && (sentences.last + [word]).join(" ").length > len sentences << [word] else sentences.last << word diff --git a/actionmailer/lib/action_mailer/message_delivery.rb b/actionmailer/lib/action_mailer/message_delivery.rb index c5ba5f9f1d..994d297768 100644 --- a/actionmailer/lib/action_mailer/message_delivery.rb +++ b/actionmailer/lib/action_mailer/message_delivery.rb @@ -1,4 +1,4 @@ -require 'delegate' +require "delegate" module ActionMailer # The <tt>ActionMailer::MessageDelivery</tt> class is used by diff --git a/actionmailer/lib/action_mailer/preview.rb b/actionmailer/lib/action_mailer/preview.rb index aab92fe8db..de9f945c36 100644 --- a/actionmailer/lib/action_mailer/preview.rb +++ b/actionmailer/lib/action_mailer/preview.rb @@ -1,4 +1,4 @@ -require 'active_support/descendants_tracker' +require "active_support/descendants_tracker" module ActionMailer module Previews #:nodoc: @@ -90,7 +90,7 @@ module ActionMailer # Returns the underscored name of the mailer preview without the suffix. def preview_name - name.sub(/Preview$/, '').underscore + name.sub(/Preview$/, "").underscore end protected diff --git a/actionmailer/lib/action_mailer/railtie.rb b/actionmailer/lib/action_mailer/railtie.rb index a727ed38e9..c47d7781cc 100644 --- a/actionmailer/lib/action_mailer/railtie.rb +++ b/actionmailer/lib/action_mailer/railtie.rb @@ -1,4 +1,4 @@ -require 'active_job/railtie' +require "active_job/railtie" require "action_mailer" require "rails" require "abstract_controller/railties/routes_helpers" @@ -18,7 +18,7 @@ module ActionMailer if app.config.force_ssl options.default_url_options ||= {} - options.default_url_options[:protocol] ||= 'https' + options.default_url_options[:protocol] ||= "https" end options.assets_dir ||= paths["public"].first @@ -61,8 +61,8 @@ module ActionMailer if options.show_previews app.routes.prepend do - get '/rails/mailers' => "rails/mailers#index", internal: true - get '/rails/mailers/*path' => "rails/mailers#preview", internal: true + get "/rails/mailers" => "rails/mailers#index", internal: true + get "/rails/mailers/*path" => "rails/mailers#preview", internal: true end if options.preview_path diff --git a/actionmailer/lib/action_mailer/test_case.rb b/actionmailer/lib/action_mailer/test_case.rb index b045e883ad..c224fa11d4 100644 --- a/actionmailer/lib/action_mailer/test_case.rb +++ b/actionmailer/lib/action_mailer/test_case.rb @@ -1,5 +1,5 @@ -require 'active_support/test_case' -require 'rails-dom-testing' +require "active_support/test_case" +require "rails-dom-testing" module ActionMailer class NonInferrableMailerError < ::StandardError @@ -99,7 +99,7 @@ module ActionMailer def set_expected_mail # :nodoc: @expected = Mail.new @expected.content_type ["text", "plain", { "charset" => charset }] - @expected.mime_version = '1.0' + @expected.mime_version = "1.0" end private @@ -113,7 +113,7 @@ module ActionMailer end def read_fixture(action) - IO.readlines(File.join(Rails.root, 'test', 'fixtures', self.class.mailer_class.name.underscore, action)) + IO.readlines(File.join(Rails.root, "test", "fixtures", self.class.mailer_class.name.underscore, action)) end end diff --git a/actionmailer/lib/action_mailer/test_helper.rb b/actionmailer/lib/action_mailer/test_helper.rb index e423aac389..c17ecad4c6 100644 --- a/actionmailer/lib/action_mailer/test_helper.rb +++ b/actionmailer/lib/action_mailer/test_helper.rb @@ -1,4 +1,4 @@ -require 'active_job' +require "active_job" module ActionMailer # Provides helper methods for testing Action Mailer, including #assert_emails diff --git a/actionmailer/lib/action_mailer/version.rb b/actionmailer/lib/action_mailer/version.rb index 06f80a8fdc..8452d6370e 100644 --- a/actionmailer/lib/action_mailer/version.rb +++ b/actionmailer/lib/action_mailer/version.rb @@ -1,4 +1,4 @@ -require_relative 'gem_version' +require_relative "gem_version" module ActionMailer # Returns the version of the currently loaded Action Mailer as a diff --git a/actionmailer/lib/rails/generators/mailer/mailer_generator.rb b/actionmailer/lib/rails/generators/mailer/mailer_generator.rb index 01bdfb0685..4b74fb4258 100644 --- a/actionmailer/lib/rails/generators/mailer/mailer_generator.rb +++ b/actionmailer/lib/rails/generators/mailer/mailer_generator.rb @@ -8,11 +8,11 @@ module Rails check_class_collision suffix: "Mailer" def create_mailer_file - template "mailer.rb", File.join('app/mailers', class_path, "#{file_name}_mailer.rb") + template "mailer.rb", File.join("app/mailers", class_path, "#{file_name}_mailer.rb") in_root do if self.behavior == :invoke && !File.exist?(application_mailer_file_name) - template 'application_mailer.rb', application_mailer_file_name + template "application_mailer.rb", application_mailer_file_name end end end @@ -21,7 +21,7 @@ module Rails protected def file_name - @_file_name ||= super.gsub(/_mailer/i, '') + @_file_name ||= super.gsub(/_mailer/i, "") end private |