mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
dry up some crazy codes
This commit is contained in:
parent
5769636663
commit
333a5659e8
1 changed files with 6 additions and 8 deletions
|
@ -476,18 +476,16 @@ module ActionView
|
||||||
|
|
||||||
html_options = html_options.stringify_keys
|
html_options = html_options.stringify_keys
|
||||||
encode = html_options.delete("encode").to_s
|
encode = html_options.delete("encode").to_s
|
||||||
cc, bcc, subject, body = html_options.delete("cc"), html_options.delete("bcc"), html_options.delete("subject"), html_options.delete("body")
|
|
||||||
|
|
||||||
extras = []
|
extras = %w{ cc bcc body subject }.map { |item|
|
||||||
extras << "cc=#{Rack::Utils.escape(cc).gsub("+", "%20")}" unless cc.nil?
|
option = html_options.delete(item) || next
|
||||||
extras << "bcc=#{Rack::Utils.escape(bcc).gsub("+", "%20")}" unless bcc.nil?
|
"#{item}=#{Rack::Utils.escape(option).gsub("+", "%20")}"
|
||||||
extras << "body=#{Rack::Utils.escape(body).gsub("+", "%20")}" unless body.nil?
|
}.compact
|
||||||
extras << "subject=#{Rack::Utils.escape(subject).gsub("+", "%20")}" unless subject.nil?
|
|
||||||
extras = extras.empty? ? '' : '?' + html_escape(extras.join('&'))
|
extras = extras.empty? ? '' : '?' + html_escape(extras.join('&'))
|
||||||
|
|
||||||
email_address_obfuscated = email_address.dup
|
email_address_obfuscated = email_address.dup
|
||||||
email_address_obfuscated.gsub!(/@/, html_options.delete("replace_at")) if html_options.has_key?("replace_at")
|
email_address_obfuscated.gsub!(/@/, html_options.delete("replace_at")) if html_options.key?("replace_at")
|
||||||
email_address_obfuscated.gsub!(/\./, html_options.delete("replace_dot")) if html_options.has_key?("replace_dot")
|
email_address_obfuscated.gsub!(/\./, html_options.delete("replace_dot")) if html_options.key?("replace_dot")
|
||||||
|
|
||||||
string = ''
|
string = ''
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue