
Research
/Security News
Shai Hulud Strikes Again (v2)
Another wave of Shai-Hulud campaign has hit npm with more than 500 packages and 700+ versions affected.
addressablerer
Advanced tools
Addressabler extends the Addressable::URI class by adding TLD parsing, domain and subdomain parsing, query modification, and restoring setting of nested hashes to query strings.
Add Addressabler to your Gemfile:
gem "addressabler", ">= 0.1"
Addressabler will automatically require addressable/uri.
Use Addressable::URI like you normally would:
@uri = Addressable::URI.parse("http://www.google.com/")
@uri.host #=> "www.google.com"
Addressabler will add the following properties:
@uri.tld #=> "com"
@uri.domain #=> "google"
@uri.subdomain #=> "www"
You can set these values, as well:
@uri.tld = "org"
@uri.host #=> "www.google.org"
@uri.domain = "amazon"
@uri.host #=> "www.amazon.org"
@uri.subdomain = "developers"
@uri.host #=> "developers.amazon.org"
Addressabler copies some of Paul Dix's Domaintrix TLD code to support fancy TLDs, as well:
@uri.host = "www.google.co.uk"
@uri.tld #=> "co.uk"
By default, Addressabler knows about ICANN public TLDs. There are, however, lots and lots of private TLDs that companies have registered. For example, as Dom Hodgson points out, "blogspot.com" is a TLD by private, non-ICANN standards which are applied by the Mozilla foundation to the TLD list.
As such, Addressabler defaults to parsing the ICANN public TLDS (Addressabler.public_tlds) but can easily be instructed to look at private TLDs like so:
Addressabler.use_private_tlds = true
You can specify custom TLDs - which aren't actually working TLD's on the internet - for internal usage. One example would be a custom development TLD:
Addressabler.custom_tlds = {
'dev' => {}, # mydomain.dev
'bar' => { 'foo' => {} } # mydomain.foo.bar
}
Addressabler adds a query_hash method to Addressable::URIs. This makes
editing query strings a lot simpler, using a familiar Hash syntax:
@uri.query_hash[:foo] = :bar
@uri.to_s #=> "http://www.google.co.uk/?foo=bar"
The current maintainer of Addressable, Bob Aman, feels rather strongly that Rails got it wrong in supporting nested hashes in query strings.
Frankly, I don't disagree with anything he has to say on the issue, but it is a problem many people have experienced.
As such, since Rack already supports building nested hashes "the Rails Way"
(shudder), I added support for assigning nested hashes to Addressable::URIs only if Rack
is available. Addressabler will attempt to load Rack::Utils and, if it finds
it, you can assign a nested hash in the query_hash= method like so:
@uri.query_hash = {:foo => {:bar => :baz}}
@uri.to_s #=> "http://www.google.co.uk/?foo[bar]=baz"
HANDLE WITH CARE! As Bob explains in the discussion, there's a better alternative to nested hashes in query strings, so try that before you install this library.
That's it. Enjoy.
Super special thankses to
FAQs
Unknown package
We found that addressablerer 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.

Research
/Security News
Another wave of Shai-Hulud campaign has hit npm with more than 500 packages and 700+ versions affected.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.