Class: MetaInspector::Parsers::TextsParser
- Defined in:
- lib/meta_inspector/parsers/texts.rb
Instance Method Summary collapse
- #best_title ⇒ Object
-
#description ⇒ Object
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.
-
#title ⇒ Object
Returns the parsed document title, from the content of the <title> tag within the <head> section.
Methods inherited from Base
Constructor Details
This class inherits a constructor from MetaInspector::Parsers::Base
Instance Method Details
#best_title ⇒ Object
12 13 14 15 |
# File 'lib/meta_inspector/parsers/texts.rb', line 12 def best_title @best_title = ['og:title'] if @main_parser.host =~ /\.youtube\.com$/ @best_title ||= find_best_title end |
#description ⇒ Object
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 ['description'] unless ['description'].nil? || ['description'].empty? secondary_description end |
#title ⇒ Object
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 |