class RailsParseHead::Base
Attributes
html[RW]
Public Instance Methods
links()
click to toggle source
# File lib/rails_parse_head/base.rb, line 29 def links html.css('link').map do |node| { rel: node['rel'], href: node['href'], type: node['type'], title: node['title'], sizes: node['sizes'], hreflang: node['hreflang'] }.compact end end
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