aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/lib
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2010-01-31 18:32:28 -0800
committerJeremy Kemper <jeremy@bitsweat.net>2010-02-01 02:02:42 -0800
commite5ab4b0d07ade8d89d633ca744c0eafbc53ee921 (patch)
treeaa2480b38f79e623b98da0274695f99db73bff20 /actionmailer/lib
parent8ae25a8e41168801590fdb95891cc5990b4db21c (diff)
downloadrails-e5ab4b0d07ade8d89d633ca744c0eafbc53ee921.tar.gz
rails-e5ab4b0d07ade8d89d633ca744c0eafbc53ee921.tar.bz2
rails-e5ab4b0d07ade8d89d633ca744c0eafbc53ee921.zip
Convert to class_attribute
Diffstat (limited to 'actionmailer/lib')
-rw-r--r--actionmailer/lib/action_mailer/base.rb10
-rw-r--r--actionmailer/lib/action_mailer/delivery_methods.rb14
-rw-r--r--actionmailer/lib/action_mailer/deprecated_api.rb2
3 files changed, 11 insertions, 15 deletions
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb
index aa9822c6ab..ec85a20f70 100644
--- a/actionmailer/lib/action_mailer/base.rb
+++ b/actionmailer/lib/action_mailer/base.rb
@@ -268,13 +268,13 @@ module ActionMailer #:nodoc:
private_class_method :new #:nodoc:
- extlib_inheritable_accessor :default_params
+ class_attribute :default_params
self.default_params = {
:mime_version => "1.0",
:charset => "utf-8",
:content_type => "text/plain",
:parts_order => [ "text/plain", "text/enriched", "text/html" ]
- }
+ }.freeze
class << self
@@ -284,9 +284,9 @@ module ActionMailer #:nodoc:
attr_writer :mailer_name
alias :controller_path :mailer_name
- def default(value=nil)
- self.default_params.merge!(value) if value
- self.default_params
+ def default(value = nil)
+ self.default_params = default_params.merge(value).freeze if value
+ default_params
end
# Receives a raw email, parses it into an email object, decodes it,
diff --git a/actionmailer/lib/action_mailer/delivery_methods.rb b/actionmailer/lib/action_mailer/delivery_methods.rb
index 7e92aea8fd..043794bb12 100644
--- a/actionmailer/lib/action_mailer/delivery_methods.rb
+++ b/actionmailer/lib/action_mailer/delivery_methods.rb
@@ -7,8 +7,7 @@ module ActionMailer
extend ActiveSupport::Concern
included do
- extlib_inheritable_accessor :delivery_methods, :delivery_method,
- :instance_writer => false
+ class_attribute :delivery_methods, :delivery_method
# Do not make this inheritable, because we always want it to propagate
cattr_accessor :raise_delivery_errors
@@ -17,7 +16,7 @@ module ActionMailer
cattr_accessor :perform_deliveries
self.perform_deliveries = true
- self.delivery_methods = {}
+ self.delivery_methods = {}.freeze
self.delivery_method = :smtp
add_delivery_method :smtp, Mail::SMTP,
@@ -53,12 +52,9 @@ module ActionMailer
# :arguments => '-i -t'
#
def add_delivery_method(symbol, klass, default_options={})
- unless respond_to?(:"#{symbol}_settings")
- extlib_inheritable_accessor(:"#{symbol}_settings", :instance_writer => false)
- end
-
+ class_attribute(:"#{symbol}_settings") unless respond_to?(:"#{symbol}_settings")
send(:"#{symbol}_settings=", default_options)
- self.delivery_methods[symbol.to_sym] = klass
+ self.delivery_methods = delivery_methods.merge(symbol.to_sym => klass).freeze
end
def wrap_delivery_behavior(mail, method=nil) #:nodoc:
@@ -87,4 +83,4 @@ module ActionMailer
self.class.wrap_delivery_behavior(message, *args)
end
end
-end \ No newline at end of file
+end
diff --git a/actionmailer/lib/action_mailer/deprecated_api.rb b/actionmailer/lib/action_mailer/deprecated_api.rb
index 54ad18f796..c08ab4164e 100644
--- a/actionmailer/lib/action_mailer/deprecated_api.rb
+++ b/actionmailer/lib/action_mailer/deprecated_api.rb
@@ -47,7 +47,7 @@ module ActionMailer
end
def template_root=(root)
- ActiveSupport::Deprecation.warn "template_root= is deprecated, use view_paths.unshift instead", caller[0,2]
+ ActiveSupport::Deprecation.warn "template_root= is deprecated, use prepend_view_path instead", caller[0,2]
self.view_paths = ActionView::Base.process_view_paths(root)
end