Class: BootstrapEmail::Converter::SupportUrlTokens
- Defined in:
- lib/bootstrap-email/converters/support_url_tokens.rb
Constant Summary collapse
- OPEN_BRACKETS =
CGI.escape('{{').freeze
- CLOSE_BRACKETS =
CGI.escape('}}').freeze
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from BootstrapEmail::Converter::Base
Class Method Details
permalink .replace(html) ⇒ Object
[View source]
7 8 9 10 11 12 13 14 |
# File 'lib/bootstrap-email/converters/support_url_tokens.rb', line 7 def self.replace(html) regex = /((href|src)=(\"|\'))((#{Regexp.quote(OPEN_BRACKETS)}).*?(#{Regexp.quote(CLOSE_BRACKETS)}))(\"|\')/ if regex.match?(html) html.gsub!(regex) do |match| "#{$1}#{CGI.unescape($4)}#{$7}" end end end |