All Projects → sporkmonger → Addressable

sporkmonger / Addressable

Licence: apache-2.0
Addressable is an alternative implementation to the URI implementation that is part of Ruby's standard library. It is flexible, offers heuristic parsing, and additionally provides extensive support for IRIs and URI templates.

Programming Languages

ruby
36898 projects - #4 most used programming language

Labels

Projects that are alternatives of or similar to Addressable

uri-query-parser
a parser and a builder to work with URI query string the right way in PHP
Stars: ✭ 38 (-97.11%)
Mutual labels:  uri
Searchwithmybrowser
Open Cortana searches with your default browser.
Stars: ✭ 285 (-78.29%)
Mutual labels:  uri
Bidi
Bidirectional URI routing
Stars: ✭ 941 (-28.33%)
Mutual labels:  uri
BridgeDb
The BridgeDb Library source code
Stars: ✭ 22 (-98.32%)
Mutual labels:  uri
Uri
🌏 Functions for making sense out of URIs in PHP
Stars: ✭ 259 (-80.27%)
Mutual labels:  uri
Tld.js
JavaScript API to work easily with complex domain names, subdomains and well-known TLDs.
Stars: ✭ 399 (-69.61%)
Mutual labels:  uri
cryptouri.rs
Rust implementation of CryptoURI: URN-like namespace for cryptographic objects with Bech32-based encoding
Stars: ✭ 33 (-97.49%)
Mutual labels:  uri
Request via
RequestVia: A Functional HTTP Client That Wraps Net::HTTP
Stars: ✭ 74 (-94.36%)
Mutual labels:  uri
Android Nosql
Lightweight, simple structured NoSQL database for Android
Stars: ✭ 284 (-78.37%)
Mutual labels:  uri
Badges4 Readme.md Profile
👩‍💻👨‍💻 Improve your README.md profile with these amazing badges.
Stars: ✭ 929 (-29.25%)
Mutual labels:  uri
ocaml-uri
RFC3986 URI parsing library for OCaml
Stars: ✭ 85 (-93.53%)
Mutual labels:  uri
httoop
HTTOOP - a fully object oriented HTTP protocol library written in python
Stars: ✭ 15 (-98.86%)
Mutual labels:  uri
Uri
URI manipulation Library
Stars: ✭ 662 (-49.58%)
Mutual labels:  uri
MSEdgeRedirect
A Tool to Redirect News, Search, Widgets, Weather and More to Your Default Browser
Stars: ✭ 1,381 (+5.18%)
Mutual labels:  uri
Handle Path Oz
Android Library to handle multiple Uri's(paths) received through Intents.
Stars: ✭ 36 (-97.26%)
Mutual labels:  uri
Linkt
A lightweight and simple Kotlin library for deep link handling on Android 🔗.
Stars: ✭ 101 (-92.31%)
Mutual labels:  uri
Uri Parser
RFC3986/RFC3987 compliant URI parser
Stars: ✭ 342 (-73.95%)
Mutual labels:  uri
Iri
Simple Immutable URI/URL Builder in Ruby
Stars: ✭ 90 (-93.15%)
Mutual labels:  uri
Sttp
The Scala HTTP client you always wanted!
Stars: ✭ 1,078 (-17.9%)
Mutual labels:  uri
Uri.js
Javascript URL mutation library
Stars: ✭ 6,119 (+366.03%)
Mutual labels:  uri

Addressable

Homepage
github.com/sporkmonger/addressable
Author
Bob Aman
Copyright
Copyright © Bob Aman
License
Apache 2.0

Gem Version Build Status Test Coverage Status Documentation Coverage Status

Description

Addressable is an alternative implementation to the URI implementation that is part of Ruby's standard library. It is flexible, offers heuristic parsing, and additionally provides extensive support for IRIs and URI templates.

Addressable closely conforms to RFC 3986, RFC 3987, and RFC 6570 (level 4).

Reference

  • {Addressable::URI}
  • {Addressable::Template}

Example usage

require "addressable/uri"

uri = Addressable::URI.parse("http://example.com/path/to/resource/")
uri.scheme
#=> "http"
uri.host
#=> "example.com"
uri.path
#=> "/path/to/resource/"

uri = Addressable::URI.parse("http://www.詹姆斯.com/")
uri.normalize
#=> #<Addressable::URI:0xc9a4c8 URI:http://www.xn--8ws00zhy3a.com/>

URI Templates

For more details, see RFC 6570.

require "addressable/template"

template = Addressable::Template.new("http://example.com/{?query*}")
template.expand({
  "query" => {
    'foo' => 'bar',
    'color' => 'red'
  }
})
#=> #<Addressable::URI:0xc9d95c URI:http://example.com/?foo=bar&color=red>

template = Addressable::Template.new("http://example.com/{?one,two,three}")
template.partial_expand({"one" => "1", "three" => 3}).pattern
#=> "http://example.com/?one=1{&two}&three=3"

template = Addressable::Template.new(
  "http://{host}{/segments*}/{?one,two,bogus}{#fragment}"
)
uri = Addressable::URI.parse(
  "http://example.com/a/b/c/?one=1&two=2#foo"
)
template.extract(uri)
#=>
# {
#   "host" => "example.com",
#   "segments" => ["a", "b", "c"],
#   "one" => "1",
#   "two" => "2",
#   "fragment" => "foo"
# }

Install

$ gem install addressable

You may optionally turn on native IDN support by installing libidn and the idn gem:

$ sudo apt-get install idn # Debian/Ubuntu
$ brew install libidn # OS X
$ gem install idn-ruby

Semantic Versioning

This project uses Semantic Versioning. You can (and should) specify your dependency using a pessimistic version constraint covering the major and minor values:

spec.add_dependency 'addressable', '~> 2.7'

If you need a specific bug fix, you can also specify minimum tiny versions without preventing updates to the latest minor release:

spec.add_dependency 'addressable', '~> 2.3', '>= 2.3.7'
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].