X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=vendor%2Frails%2Factionmailer%2Flib%2Faction_mailer%2Fpart_container.rb;fp=vendor%2Frails%2Factionmailer%2Flib%2Faction_mailer%2Fpart_container.rb;h=0000000000000000000000000000000000000000;hb=36d9f3351a3b4e8159279445190e2287ffdea86c;hp=abfd8f84266ff64472ef40e2ba363ece543615ac;hpb=913cf6054b1d29b5d2f5e620304af7ee77cc1f1f;p=feedcatcher.git diff --git a/vendor/rails/actionmailer/lib/action_mailer/part_container.rb b/vendor/rails/actionmailer/lib/action_mailer/part_container.rb deleted file mode 100644 index abfd8f8..0000000 --- a/vendor/rails/actionmailer/lib/action_mailer/part_container.rb +++ /dev/null @@ -1,55 +0,0 @@ -module ActionMailer - # Accessors and helpers that ActionMailer::Base and ActionMailer::Part have - # in common. Using these helpers you can easily add subparts or attachments - # to your message: - # - # def my_mail_message(...) - # ... - # part "text/plain" do |p| - # p.body "hello, world" - # p.transfer_encoding "base64" - # end - # - # attachment "image/jpg" do |a| - # a.body = File.read("hello.jpg") - # a.filename = "hello.jpg" - # end - # end - module PartContainer - # The list of subparts of this container - attr_reader :parts - - # Add a part to a multipart message, with the given content-type. The - # part itself is yielded to the block so that other properties (charset, - # body, headers, etc.) can be set on it. - def part(params) - params = {:content_type => params} if String === params - part = Part.new(params) - yield part if block_given? - @parts << part - end - - # Add an attachment to a multipart message. This is simply a part with the - # content-disposition set to "attachment". - def attachment(params, &block) - params = { :content_type => params } if String === params - params = { :disposition => "attachment", - :transfer_encoding => "base64" }.merge(params) - part(params, &block) - end - - private - - def parse_content_type(defaults=nil) - if content_type.blank? - return defaults ? - [ defaults.content_type, { 'charset' => defaults.charset } ] : - [ nil, {} ] - end - ctype, *attrs = content_type.split(/;\s*/) - attrs = attrs.inject({}) { |h,s| k,v = s.split(/=/, 2); h[k] = v; h } - [ctype, {"charset" => charset || defaults && defaults.charset}.merge(attrs)] - end - - end -end