class NewsletterReader::Parsers::PrettyGoodWeeklyParser
Constants
- USELESS_LINKS
Attributes
html_doc[R]
Public Instance Methods
parse(html_doc)
click to toggle source
# File lib/newsletter_reader/parsers/pretty_good_weekly_parser.rb, line 10 def parse(html_doc) @html_doc = html_doc html_doc.css('a').each_with_object([]) do |link, links| if actual_link?(link) links << Link.new(href: link['href'], content: link.content) end end.compact end
Private Instance Methods
actual_link?(link)
click to toggle source
# File lib/newsletter_reader/parsers/pretty_good_weekly_parser.rb, line 23 def actual_link?(link) content = link.content.strip !content.empty? && !USELESS_LINKS.include?(content) end