Module: Email::ContentRules::Helpers
- Defined in:
- app/services/email/content_rules.rb
Overview
Helpers for rule implementations — wraps Nokogiri parsing.
Class Method Summary collapse
-
.content_nodes(fragment) ⇒ Object
The authored MAIN CONTENT only — excludes the canonical chrome (email-options, branded header/footer) so rules judge the model's content, not the scaffold.
- .parse(html) ⇒ Object
Class Method Details
.content_nodes(fragment) ⇒ Object
The authored MAIN CONTENT only — excludes the canonical chrome (email-options,
branded header/footer) so rules judge the model's content, not the scaffold.
92 93 94 95 |
# File 'app/services/email/content_rules.rb', line 92 def content_nodes(fragment) fragment.css('.email-options, .email-style, .email-footer').each(&:unlink) fragment end |
.parse(html) ⇒ Object
82 83 84 85 86 87 88 |
# File 'app/services/email/content_rules.rb', line 82 def parse(html) if defined?(Nokogiri::HTML5) Nokogiri::HTML5.fragment(html.to_s) else Nokogiri::HTML.fragment(html.to_s) end end |