No release in over 3 years
Low commit activity in last 3 years
Parse head html (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/head)
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.0
~> 0.8
~> 13.0
~> 3.0
~> 0.16

Runtime

~> 4.4
~> 1.10
 Project Readme

RailsParseHead

Gem Version Maintainability Build Status security Gem Coverage Status

RailsParseHead is a simple Ruby library for parsing head element information from a website.

Learn more about the head element at:

Installation

Add this line to your application's Gemfile:

gem 'rails_parse_head'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rails_parse_head

Usage

Parsing an URL

rph = RailsParseHead.fetch('https://github.com')
rph.title # => "The world’s leading software development platform · GitHub"
rph.metas # => [{:charset=>"utf-8"}, {:name=>"viewport", :content=>"width=device-width"}]
rph.links # => [{:rel=>"dns-prefetch", :href=>"https://github.githubassets.com"}, {:rel=>"dns-prefetch", :href=>"https://avatars0.githubusercontent.com"}]

Custom header request

rph = RailsParseHead.fetch('https://github.com', headers: { accept: 'application/json' })

See: https://github.com/httprb/http/wiki/Headers

Parsing a HTML string

rph = RailsParseHead.parse("<meta charset='utf-8'>")
rph.metas # => [{:charset=>"utf-8"}]

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/BorisBresciani/rails_parse_head. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the RailsParseHead project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.