Class: MetaInspector::Parsers::TextsParser

Inherits:
Base
  • Object
show all
Defined in:
lib/meta_inspector/parsers/texts.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from MetaInspector::Parsers::Base

Instance Method Details

#best_titleObject



12
13
14
15
# File 'lib/meta_inspector/parsers/texts.rb', line 12

def best_title
  @best_title = meta['og:title'] if @main_parser.host =~ /\.youtube\.com$/
  @best_title ||= find_best_title
end

#descriptionObject

A description getter that first checks for a meta description and if not present will guess by looking at the first paragraph with more than 120 characters



20
21
22
23
# File 'lib/meta_inspector/parsers/texts.rb', line 20

def description
  return meta['description'] unless meta['description'].nil? || meta['description'].empty?
  secondary_description
end

#titleObject

Returns the parsed document title, from the content of the <title> tag within the <head> section.



8
9
10
# File 'lib/meta_inspector/parsers/texts.rb', line 8

def title
  @title ||= parsed.css('head title').inner_text rescue nil
end