class RailsParseHead::Base

Attributes

html[RW]

Public Instance Methods

metas() click to toggle source
# File lib/rails_parse_head/base.rb, line 15
def metas
  html.css('meta').map do |node|
    {
      name: node['name'],
      property: node['property'],
      content: node['content'],
      itemprop: node['itemprop'],
      description: node['description'],
      class: node['class'],
      charset: node['charset']
    }.compact
  end
end
title() click to toggle source
# File lib/rails_parse_head/base.rb, line 10
def title
  title = html.at_css('title')
  title.nil? ? '' : title.text
end

Private Instance Methods

document(node) click to toggle source
# File lib/rails_parse_head/base.rb, line 44
def document(node)
  Nokogiri::HTML(node)
end