1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fix markup for cattr_accessors in Action View and Action Mailer to work better with RDoc 2+.

This commit is contained in:
Mike Gunderloy 2008-11-16 20:44:30 -06:00
parent b58d0a9447
commit 1d8c4cf6e0
3 changed files with 76 additions and 45 deletions

View file

@ -201,49 +201,7 @@ module ActionMailer #:nodoc:
# end # end
# #
# #
# = Configuration options # Configuration options are specified on the class level, like <tt>ActionMailer::Base.template_root = "/my/templates"</tt>
#
# These options are specified on the class level, like <tt>ActionMailer::Base.template_root = "/my/templates"</tt>
#
# * <tt>template_root</tt> - Determines the base from which template references will be made.
#
# * <tt>logger</tt> - the logger is used for generating information on the mailing run if available.
# Can be set to nil for no logging. Compatible with both Ruby's own Logger and Log4r loggers.
#
# * <tt>smtp_settings</tt> - Allows detailed configuration for <tt>:smtp</tt> delivery method:
# * <tt>:address</tt> - Allows you to use a remote mail server. Just change it from its default "localhost" setting.
# * <tt>:port</tt> - On the off chance that your mail server doesn't run on port 25, you can change it.
# * <tt>:domain</tt> - If you need to specify a HELO domain, you can do it here.
# * <tt>:user_name</tt> - If your mail server requires authentication, set the username in this setting.
# * <tt>:password</tt> - If your mail server requires authentication, set the password in this setting.
# * <tt>:authentication</tt> - If your mail server requires authentication, you need to specify the authentication type here.
# This is a symbol and one of <tt>:plain</tt>, <tt>:login</tt>, <tt>:cram_md5</tt>.
#
# * <tt>sendmail_settings</tt> - Allows you to override options for the <tt>:sendmail</tt> delivery method.
# * <tt>:location</tt> - The location of the sendmail executable. Defaults to <tt>/usr/sbin/sendmail</tt>.
# * <tt>:arguments</tt> - The command line arguments. Defaults to <tt>-i -t</tt>.
#
# * <tt>raise_delivery_errors</tt> - Whether or not errors should be raised if the email fails to be delivered.
#
# * <tt>delivery_method</tt> - Defines a delivery method. Possible values are <tt>:smtp</tt> (default), <tt>:sendmail</tt>, and <tt>:test</tt>.
#
# * <tt>perform_deliveries</tt> - Determines whether <tt>deliver_*</tt> methods are actually carried out. By default they are,
# but this can be turned off to help functional testing.
#
# * <tt>deliveries</tt> - Keeps an array of all the emails sent out through the Action Mailer with <tt>delivery_method :test</tt>. Most useful
# for unit and functional testing.
#
# * <tt>default_charset</tt> - The default charset used for the body and to encode the subject. Defaults to UTF-8. You can also
# pick a different charset from inside a method with +charset+.
# * <tt>default_content_type</tt> - The default content type used for the main part of the message. Defaults to "text/plain". You
# can also pick a different content type from inside a method with +content_type+.
# * <tt>default_mime_version</tt> - The default mime version used for the message. Defaults to <tt>1.0</tt>. You
# can also pick a different value from inside a method with +mime_version+.
# * <tt>default_implicit_parts_order</tt> - When a message is built implicitly (i.e. multiple parts are assembled from templates
# which specify the content type in their filenames) this variable controls how the parts are ordered. Defaults to
# <tt>["text/html", "text/enriched", "text/plain"]</tt>. Items that appear first in the array have higher priority in the mail client
# and appear last in the mime encoded message. You can also pick a different order from inside a method with
# +implicit_parts_order+.
class Base class Base
include AdvAttrAccessor, PartContainer include AdvAttrAccessor, PartContainer
if Object.const_defined?(:ActionController) if Object.const_defined?(:ActionController)
@ -254,6 +212,10 @@ module ActionMailer #:nodoc:
private_class_method :new #:nodoc: private_class_method :new #:nodoc:
class_inheritable_accessor :view_paths class_inheritable_accessor :view_paths
##
# :singleton-method:
# The logger is used for generating information on the mailing run if available.
# Can be set to nil for no logging. Compatible with both Ruby's own Logger and Log4r loggers.
cattr_accessor :logger cattr_accessor :logger
@@smtp_settings = { @@smtp_settings = {
@ -264,88 +226,150 @@ module ActionMailer #:nodoc:
:password => nil, :password => nil,
:authentication => nil :authentication => nil
} }
##
# :singleton-method:
# Allows detailed configuration for <tt>:smtp</tt> delivery method:
# * <tt>:address</tt> - Allows you to use a remote mail server. Just change it from its default "localhost" setting.
# * <tt>:port</tt> - On the off chance that your mail server doesn't run on port 25, you can change it.
# * <tt>:domain</tt> - If you need to specify a HELO domain, you can do it here.
# * <tt>:user_name</tt> - If your mail server requires authentication, set the username in this setting.
# * <tt>:password</tt> - If your mail server requires authentication, set the password in this setting.
# * <tt>:authentication</tt> - If your mail server requires authentication, you need to specify the authentication type here.
# This is a symbol and one of <tt>:plain</tt>, <tt>:login</tt>, <tt>:cram_md5</tt>.
cattr_accessor :smtp_settings cattr_accessor :smtp_settings
@@sendmail_settings = { @@sendmail_settings = {
:location => '/usr/sbin/sendmail', :location => '/usr/sbin/sendmail',
:arguments => '-i -t' :arguments => '-i -t'
} }
##
# :singleton-method:
# Allows you to override options for the <tt>:sendmail</tt> delivery method.
# * <tt>:location</tt> - The location of the sendmail executable. Defaults to <tt>/usr/sbin/sendmail</tt>.
# * <tt>:arguments</tt> - The command line arguments. Defaults to <tt>-i -t</tt>.
cattr_accessor :sendmail_settings cattr_accessor :sendmail_settings
@@raise_delivery_errors = true @@raise_delivery_errors = true
##
# :singleton-method:
# Whether or not errors should be raised if the email fails to be delivered.
cattr_accessor :raise_delivery_errors cattr_accessor :raise_delivery_errors
##
# :singleton-method:
# Defines a delivery method. Possible values are <tt>:smtp</tt> (default), <tt>:sendmail</tt>, and <tt>:test</tt>.
superclass_delegating_accessor :delivery_method superclass_delegating_accessor :delivery_method
self.delivery_method = :smtp self.delivery_method = :smtp
@@perform_deliveries = true @@perform_deliveries = true
##
# :singleton-method:
# Determines whether <tt>deliver_*</tt> methods are actually carried out. By default they are,
# but this can be turned off to help functional testing.
cattr_accessor :perform_deliveries cattr_accessor :perform_deliveries
@@deliveries = [] @@deliveries = []
##
# :singleton-method:
# Keeps an array of all the emails sent out through the Action Mailer with <tt>delivery_method :test</tt>. Most useful
# for unit and functional testing.
cattr_accessor :deliveries cattr_accessor :deliveries
@@default_charset = "utf-8" @@default_charset = "utf-8"
##
# :singleton-method:
# The default charset used for the body and to encode the subject. Defaults to UTF-8. You can also
# pick a different charset from inside a method with +charset+.
cattr_accessor :default_charset cattr_accessor :default_charset
@@default_content_type = "text/plain" @@default_content_type = "text/plain"
##
# :singleton-method:
# The default content type used for the main part of the message. Defaults to "text/plain". You
# can also pick a different content type from inside a method with +content_type+.
cattr_accessor :default_content_type cattr_accessor :default_content_type
@@default_mime_version = "1.0" @@default_mime_version = "1.0"
##
# :singleton-method:
# The default mime version used for the message. Defaults to <tt>1.0</tt>. You
# can also pick a different value from inside a method with +mime_version+.
cattr_accessor :default_mime_version cattr_accessor :default_mime_version
@@default_implicit_parts_order = [ "text/html", "text/enriched", "text/plain" ] @@default_implicit_parts_order = [ "text/html", "text/enriched", "text/plain" ]
##
# :singleton-method:
# When a message is built implicitly (i.e. multiple parts are assembled from templates
# which specify the content type in their filenames) this variable controls how the parts are ordered. Defaults to
# <tt>["text/html", "text/enriched", "text/plain"]</tt>. Items that appear first in the array have higher priority in the mail client
# and appear last in the mime encoded message. You can also pick a different order from inside a method with
# +implicit_parts_order+.
cattr_accessor :default_implicit_parts_order cattr_accessor :default_implicit_parts_order
cattr_reader :protected_instance_variables cattr_reader :protected_instance_variables
@@protected_instance_variables = %w(@body) @@protected_instance_variables = %w(@body)
##
# Specify the BCC addresses for the message # Specify the BCC addresses for the message
adv_attr_accessor :bcc adv_attr_accessor :bcc
##
# Define the body of the message. This is either a Hash (in which case it # Define the body of the message. This is either a Hash (in which case it
# specifies the variables to pass to the template when it is rendered), # specifies the variables to pass to the template when it is rendered),
# or a string, in which case it specifies the actual text of the message. # or a string, in which case it specifies the actual text of the message.
adv_attr_accessor :body adv_attr_accessor :body
##
# Specify the CC addresses for the message. # Specify the CC addresses for the message.
adv_attr_accessor :cc adv_attr_accessor :cc
##
# Specify the charset to use for the message. This defaults to the # Specify the charset to use for the message. This defaults to the
# +default_charset+ specified for ActionMailer::Base. # +default_charset+ specified for ActionMailer::Base.
adv_attr_accessor :charset adv_attr_accessor :charset
##
# Specify the content type for the message. This defaults to <tt>text/plain</tt> # Specify the content type for the message. This defaults to <tt>text/plain</tt>
# in most cases, but can be automatically set in some situations. # in most cases, but can be automatically set in some situations.
adv_attr_accessor :content_type adv_attr_accessor :content_type
##
# Specify the from address for the message. # Specify the from address for the message.
adv_attr_accessor :from adv_attr_accessor :from
##
# Specify the address (if different than the "from" address) to direct # Specify the address (if different than the "from" address) to direct
# replies to this message. # replies to this message.
adv_attr_accessor :reply_to adv_attr_accessor :reply_to
##
# Specify additional headers to be added to the message. # Specify additional headers to be added to the message.
adv_attr_accessor :headers adv_attr_accessor :headers
##
# Specify the order in which parts should be sorted, based on content-type. # Specify the order in which parts should be sorted, based on content-type.
# This defaults to the value for the +default_implicit_parts_order+. # This defaults to the value for the +default_implicit_parts_order+.
adv_attr_accessor :implicit_parts_order adv_attr_accessor :implicit_parts_order
##
# Defaults to "1.0", but may be explicitly given if needed. # Defaults to "1.0", but may be explicitly given if needed.
adv_attr_accessor :mime_version adv_attr_accessor :mime_version
##
# The recipient addresses for the message, either as a string (for a single # The recipient addresses for the message, either as a string (for a single
# address) or an array (for multiple addresses). # address) or an array (for multiple addresses).
adv_attr_accessor :recipients adv_attr_accessor :recipients
##
# The date on which the message was sent. If not set (the default), the # The date on which the message was sent. If not set (the default), the
# header will be set by the delivery agent. # header will be set by the delivery agent.
adv_attr_accessor :sent_on adv_attr_accessor :sent_on
##
# Specify the subject of the message. # Specify the subject of the message.
adv_attr_accessor :subject adv_attr_accessor :subject
##
# Specify the template name to use for current message. This is the "base" # Specify the template name to use for current message. This is the "base"
# template name, without the extension or directory, and may be used to # template name, without the extension or directory, and may be used to
# have multiple mailer methods share the same template. # have multiple mailer methods share the same template.
@ -432,6 +456,7 @@ module ActionMailer #:nodoc:
"Use ActionView::Base.register_template_extension instead", caller) "Use ActionView::Base.register_template_extension instead", caller)
end end
# Determines the base from which template references will be made.
def template_root def template_root
self.view_paths && self.view_paths.first self.view_paths && self.view_paths.first
end end

View file

@ -183,13 +183,17 @@ module ActionView #:nodoc:
@@exempt_from_layout.merge(regexps) @@exempt_from_layout.merge(regexps)
end end
@@debug_rjs = false
##
# :singleton-method:
# Specify whether RJS responses should be wrapped in a try/catch block # Specify whether RJS responses should be wrapped in a try/catch block
# that alert()s the caught exception (and then re-raises it). # that alert()s the caught exception (and then re-raises it).
@@debug_rjs = false
cattr_accessor :debug_rjs cattr_accessor :debug_rjs
# A warning will be displayed whenever an action results in a cache miss on your view paths.
@@warn_cache_misses = false @@warn_cache_misses = false
##
# :singleton-method:
# A warning will be displayed whenever an action results in a cache miss on your view paths.
cattr_accessor :warn_cache_misses cattr_accessor :warn_cache_misses
attr_internal :request attr_internal :request

View file

@ -42,6 +42,8 @@ module ActionView
class ERB < TemplateHandler class ERB < TemplateHandler
include Compilable include Compilable
##
# :singleton-method:
# Specify trim mode for the ERB compiler. Defaults to '-'. # Specify trim mode for the ERB compiler. Defaults to '-'.
# See ERb documentation for suitable values. # See ERb documentation for suitable values.
cattr_accessor :erb_trim_mode cattr_accessor :erb_trim_mode