Class: RailsParseHead::Base
- Inherits:
-
Object
- Object
- RailsParseHead::Base
- Defined in:
- lib/rails_parse_head/base.rb
Instance Attribute Summary collapse
-
#html ⇒ Object
Returns the value of attribute html.
Instance Method Summary collapse
Instance Attribute Details
#html ⇒ Object
Returns the value of attribute html.
8 9 10 |
# File 'lib/rails_parse_head/base.rb', line 8 def html @html end |
Instance Method Details
#links ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# 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 ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rails_parse_head/base.rb', line 15 def 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 ⇒ Object
10 11 12 13 |
# File 'lib/rails_parse_head/base.rb', line 10 def title title = html.at_css('title') title.nil? ? '' : title.text end |