Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fnando/root_domain
With root_domain, you can easily extract the root domain, expanding any input from punycode into ASCII entries.
https://github.com/fnando/root_domain
Last synced: 28 days ago
JSON representation
With root_domain, you can easily extract the root domain, expanding any input from punycode into ASCII entries.
- Host: GitHub
- URL: https://github.com/fnando/root_domain
- Owner: fnando
- License: mit
- Created: 2020-09-22T06:41:33.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-09-05T02:15:36.000Z (about 1 year ago)
- Last Synced: 2024-04-26T15:04:49.973Z (7 months ago)
- Language: Ruby
- Homepage:
- Size: 75.2 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# root_domain
[![Tests](https://github.com/fnando/root_domain/workflows/ruby-tests/badge.svg)](https://github.com/fnando/root_domain)
[![Code Climate](https://codeclimate.com/github/fnando/root_domain/badges/gpa.svg)](https://codeclimate.com/github/fnando/root_domain)
[![Gem](https://img.shields.io/gem/v/root_domain.svg)](https://rubygems.org/gems/root_domain)
[![Gem](https://img.shields.io/gem/dt/root_domain.svg)](https://rubygems.org/gems/root_domain)If you ever worked with domain validation, you probably needed to extract the
root domain. This means that, given some hostname, you must remove subdomains
from the original input, taking into account not only official Internet
[TLDs](https://en.wikipedia.org/wiki/Top-level_domain), but
[SLDs](https://en.wikipedia.org/wiki/Second-level_domain) too.With root_domain, you can easily extract the root domain, expanding any input
from punycode into ASCII entries.## Installation
```bash
gem install root_domain
```Or add the following line to your project's Gemfile:
```ruby
gem "root_domain"
```## Usage
```ruby
require "root_domain"RootDomain.call("www.example.com")
#=> example.comRootDomain.call("www.example.com.br")
#=> example.com.brRootDomain.call("myapp.apps.🤯.com")
#=> xn--oq9h.com
```## Maintainer
- [Nando Vieira](https://github.com/fnando)
## Contributors
- https://github.com/fnando/root_domain/contributors
## Contributing
For more details about how to contribute, please read
https://github.com/fnando/root_domain/blob/main/CONTRIBUTING.md.## License
The gem is available as open source under the terms of the
[MIT License](https://opensource.org/licenses/MIT). A copy of the license can be
found at https://github.com/fnando/root_domain/blob/main/LICENSE.md.## Code of Conduct
Everyone interacting in the root_domain project's codebases, issue trackers,
chat rooms and mailing lists is expected to follow the
[code of conduct](https://github.com/fnando/root_domain/blob/main/CODE_OF_CONDUCT.md).