
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Parse varying urls with PublicSuffix the easy way.
The PublicSuffix gem works great if you give it nice, clean urls WITHOUT a transfer protocol. But what if your application has one (or multiple) urls with or without protocols?
LazyDomain assumes it could be either way and uses URI to make up the difference. Because URI can only parse a url WITH a protocol, Lazy Domain automatically adds 'http://' if it is not already present in a url. Now, you can easily use PublicSuffix for varying urls.
$ gem install lazy_domain
Because LazyDomain is simply a wrapper for PublicSuffix, the usage is exactly the same.
Example domain without subdomains.
domain = LazyDomain.parse("google.com")
# => #<PublicSuffix::Domain>
domain.tld
# => "com"
domain.sld
# => "google"
domain.trd
# => nil
domain.domain
# => "google.com"
domain.subdomain
# => nil
Example domain with subdomains.
domain = LazyDomain.parse("www.google.com")
# => #<PublicSuffix::Domain>
domain.tld
# => "com"
domain.sld
# => "google"
domain.trd
# => "www"
domain.domain
# => "google.com"
domain.subdomain
# => "www.google.com"
Simple validation example.
LazyDomain.valid?("google.com")
# => true
LazyDomain.valid?("www.google.com")
# => true
LazyDomain.valid?("x.yz")
# => false
You can do everything mentioned above, but the magic of LazyDomain is you can now pass different types of urls!
For example, all of this...
domain = LazyDomain.parse("google.com")
domain = LazyDomain.parse("http://google.com")
domain = LazyDomain.parse("ftp://google.com")
domain = LazyDomain.parse("somethingcrazy://google.com")
domain = LazyDomain.parse("http://abc.defg.hijk.google.com")
domain = LazyDomain.parse("http://abc.defg.hijk.google.com/asubdirectory/andanother")
...returns something like this.
# => #<PublicSuffix::Domain:0x0055c2344f0168 @sld="google", @tld="com", @trd="abc.defg.hijk">
Enjoy!
FAQs
Unknown package
We found that lazy_domain demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.