New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

qasa-url

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

qasa-url

  • 0.1.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

URL

URL is a simple URL parser and construction tool for Ruby. It doesn't follow any RFC, instead, it behaves as you expect.

Background

This gem was born out of frustration with the URL handling in Ruby's standard library and other gems. I wanted to be able to parse a URL, modify it and then get the modified URL back as a string. I also wanted to be able to join paths and query strings to URLs without having to worry about trailing slashes and question marks.

Installation

gem "qasa-url"

Usage

# Initialize a new URL object by parsing a URL string:
url = URL.parse("http://www.example.com:404/path")
url.to_s # => "http://www.example.com:404/path"

# Modify a URL:
url.scheme = "https"
url.port = nil
url.join("/to")
url.join("/nowhere")
url.to_s # => "https://www.example.com/path/to/nowhere"

# Add a query string:
url.merge(foo: "bar")
url.to_s # => "https://www.example.com/path/to/nowhere?foo=bar"

# Initialize a URL object with just a domain name:
url = URL["example.com"]
url.join("/path", "to", "nowhere")

# Note: If you don't provide a protocol, it'll default to "https":
url.to_s # => "https://example.com/path/to/nowhere"

Alternatives

If you're looking for something that parses URLs in Ruby and Ruby on Rails and closely conforms to RFC 3986, RFC 3987, and RFC 6570 (level 4), check out addressable. If you need to do domain name validation check out public_suffix.

Risks using this gem

The risk should be considered low. The gem is very small, simple and well-tested. The only risk is that it doesn't follow any RFCs. This means that it might not behave as you expect. However, it's very unlikely that you'll run into any problems. The gem is maintained by Qasa, we're a small team of dedicated Ruby developers.

Contributing

Bug reports and pull requests are always welcome!

License

See LICENSE.

FAQs

Package last updated on 11 Feb 2025

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc