Permalink
Browse files

simplify secondary_description

  • Loading branch information...
1 parent dc112b9 commit 72898be8381f48c59df6e3bc1c975227200b6336 @jaimeiniesta committed Dec 1, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/meta_inspector/scraper.rb
@@ -245,7 +245,8 @@ def unrelativize_url(url)
# Look for the first <p> block with 120 characters or more
def secondary_description
- (p = parsed_document.search('//p').map(&:text).select{ |p| p.length > 120 }.first).nil? ? '' : p
+ first_long_paragraph = parsed_document.search('//p[string-length() >= 120]').first
+ first_long_paragraph ? first_long_paragraph.text : ''
end
def charset_from_meta_charset

0 comments on commit 72898be

Please sign in to comment.