class Rounders::CssSelectorMatcher::CssSelector

Attributes

pattern[R]

Public Class Methods

new(pattern) click to toggle source
# File lib/rounders/css_selector_matcher/css_selector.rb, line 6
def initialize(pattern)
  @pattern = pattern
end

Public Instance Methods

match(mail) click to toggle source
# File lib/rounders/css_selector_matcher/css_selector.rb, line 10
def match(mail)
  return if mail.html_part.blank?
  html_part = Nokogiri::HTML(mail.html_part.body.to_s)
  node = html_part.css(pattern)
  node.present? ? node : nil
end