From 2789b5d2cefb4765e5bd2d14b10109cfe2d7f96b Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 6 Jul 2005 08:22:56 +0000 Subject: Tuned documentation for release (AM) git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1726 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionmailer/CHANGELOG | 2 +- actionmailer/README | 11 +++++----- .../lib/action_mailer/adv_attr_accessor.rb | 12 +++++------ actionmailer/lib/action_mailer/base.rb | 8 +++---- actionmailer/lib/action_mailer/helpers.rb | 25 ++-------------------- actionmailer/lib/action_mailer/part.rb | 3 --- actionmailer/lib/action_mailer/part_container.rb | 2 +- actionmailer/lib/action_mailer/quoting.rb | 9 +++----- 8 files changed, 21 insertions(+), 51 deletions(-) (limited to 'actionmailer') diff --git a/actionmailer/CHANGELOG b/actionmailer/CHANGELOG index 010799ed25..b0740a4836 100644 --- a/actionmailer/CHANGELOG +++ b/actionmailer/CHANGELOG @@ -1,4 +1,4 @@ -*SVN* +*1.0.0* (6 July, 2005) * Avoid adding nil header values #1392 diff --git a/actionmailer/README b/actionmailer/README index d512f04031..e0d5840c6f 100755 --- a/actionmailer/README +++ b/actionmailer/README @@ -16,16 +16,15 @@ in methods on the service layer. Subject, recipients, sender, and timestamp are all set up this way. An example of such a method: def signed_up(recipient) - @recipients = recipient - @subject = "[Signed up] Welcome #{recipient}" - @from = "system@loudthinking.com" - @sent_on = Time.local(2004, 12, 12) + recipients recipient + subject "[Signed up] Welcome #{recipient}" + from "system@loudthinking.com" - @body["recipient"] = recipient + body(:recipient => recipient) end The body of the email is created by using an Action View template (regular -ERb) that has the content of the @body hash available as instance variables. +ERb) that has the content of the body hash parameter available as instance variables. So the corresponding body template for the method above could look like this: Hello there, diff --git a/actionmailer/lib/action_mailer/adv_attr_accessor.rb b/actionmailer/lib/action_mailer/adv_attr_accessor.rb index 47c02ba198..b1f5d4540b 100644 --- a/actionmailer/lib/action_mailer/adv_attr_accessor.rb +++ b/actionmailer/lib/action_mailer/adv_attr_accessor.rb @@ -1,12 +1,11 @@ module ActionMailer - module AdvAttrAccessor + module AdvAttrAccessor #:nodoc: def self.append_features(base) super base.extend(ClassMethods) end - module ClassMethods - + module ClassMethods #:nodoc: def adv_attr_accessor(*names) names.each do |name| define_method("#{name}=") do |value| @@ -23,19 +22,18 @@ module ActionMailer end end end - end end end + module ActionMailer - module AdvAttrAccessor + module AdvAttrAccessor #:nodoc: def self.append_features(base) super base.extend(ClassMethods) end - module ClassMethods - + module ClassMethods #:nodoc: def adv_attr_accessor(*names) names.each do |name| define_method("#{name}=") do |value| diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 21f4086008..61bc74a81c 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -13,7 +13,7 @@ module ActionMailer #:nodoc: # def signup_notification(recipient) # recipients recipient.email_address_with_name # subject "New account information" - # body Hash.new("account" => recipient) + # body { "account" => recipient } # from "system@example.com" # end # @@ -164,13 +164,13 @@ module ActionMailer #:nodoc: # will be initialized according to the named method. If not, the mailer will # remain uninitialized (useful when you only need to invoke the "receive" # method, for instance). - def initialize(method_name=nil, *parameters) + def initialize(method_name=nil, *parameters) #:nodoc: create!(method_name, *parameters) if method_name end # Initialize the mailer via the given +method_name+. The body will be # rendered and a new TMail::Mail object created. - def create!(method_name, *parameters) + def create!(method_name, *parameters) #:nodoc: @bcc = @cc = @from = @recipients = @sent_on = @subject = nil @charset = @@default_charset.dup @content_type = @@default_content_type.dup @@ -225,7 +225,7 @@ module ActionMailer #:nodoc: # Delivers the cached TMail::Mail object. If no TMail::Mail object has been # created (via the #create! method, for instance) this will fail. - def deliver! + def deliver! #:nodoc: raise "no mail object available for delivery!" unless @mail logger.info "Sent mail:\n #{mail.encoded}" unless logger.nil? diff --git a/actionmailer/lib/action_mailer/helpers.rb b/actionmailer/lib/action_mailer/helpers.rb index c0e02edfb1..f482758386 100644 --- a/actionmailer/lib/action_mailer/helpers.rb +++ b/actionmailer/lib/action_mailer/helpers.rb @@ -24,28 +24,7 @@ module ActionMailer #:nodoc: end end - # The template helpers serves to relieve the templates from including the same inline code again and again. It's a - # set of standardized methods for working with forms (FormHelper), dates (DateHelper), texts (TextHelper), and - # Active Records (ActiveRecordHelper) that's available to all templates by default. - # - # It's also really easy to make your own helpers and it's much encouraged to keep the template files free - # from complicated logic. It's even encouraged to bundle common compositions of methods from other helpers - # (often the common helpers) as they're used by the specific application. - # - # module MyHelper - # def hello_world() "hello world" end - # end - # - # MyHelper can now be included in a controller, like this: - # - # class MyController < ActionController::Base - # helper :my_helper - # end - # - # ...and, same as above, used in any template rendered from MyController, like this: - # - # Let's hear what the helper has to say: <%= hello_world %> - module ClassMethods + module ClassMethods #:nodoc: # Makes all the (instance) methods in the helper module available to templates rendered through this controller. # See ActionView::Helpers (link:classes/ActionView/Helpers.html) for more about making your own helper modules # available to the templates. @@ -133,4 +112,4 @@ module ActionMailer #:nodoc: end end end -end +end \ No newline at end of file diff --git a/actionmailer/lib/action_mailer/part.rb b/actionmailer/lib/action_mailer/part.rb index 7b9260f225..60cbe0d3fe 100644 --- a/actionmailer/lib/action_mailer/part.rb +++ b/actionmailer/lib/action_mailer/part.rb @@ -2,7 +2,6 @@ require 'action_mailer/adv_attr_accessor' require 'action_mailer/part_container' module ActionMailer - class Part #:nodoc: include ActionMailer::AdvAttrAccessor include ActionMailer::PartContainer @@ -69,10 +68,8 @@ module ActionMailer end private - def squish(values={}) values.delete_if { |k,v| v.nil? } end end - end diff --git a/actionmailer/lib/action_mailer/part_container.rb b/actionmailer/lib/action_mailer/part_container.rb index 57ad2f5157..7a69efeb49 100644 --- a/actionmailer/lib/action_mailer/part_container.rb +++ b/actionmailer/lib/action_mailer/part_container.rb @@ -1,5 +1,5 @@ module ActionMailer - module PartContainer + module PartContainer #:nodoc: attr_reader :parts # Add a part to a multipart message, with the given content-type. The diff --git a/actionmailer/lib/action_mailer/quoting.rb b/actionmailer/lib/action_mailer/quoting.rb index 28c456f25d..b44f4d50df 100644 --- a/actionmailer/lib/action_mailer/quoting.rb +++ b/actionmailer/lib/action_mailer/quoting.rb @@ -1,6 +1,5 @@ module ActionMailer - module Quoting - + module Quoting #:nodoc: # Convert the given text into quoted printable format, with an instruction # that the text be eventually interpreted in the given charset. def quoted_printable(text, charset) @@ -45,12 +44,11 @@ module ActionMailer def quote_any_address_if_necessary(charset, *args) args.map { |v| quote_address_if_necessary(v, charset) } end - end end -module ActionMailer - module Quoting +module ActionMailer + module Quoting #:nodoc: # Convert the given text into quoted printable format, with an instruction # that the text be eventually interpreted in the given charset. def quoted_printable(text, charset) @@ -97,6 +95,5 @@ module ActionMailer def quote_any_address_if_necessary(charset, *args) args.map { |v| quote_address_if_necessary(v, charset) } end - end end -- cgit v1.2.3