• Stars
    star
    1,535
  • Rank 29,319 (Top 0.6 %)
  • Language
    Ruby
  • License
    Apache License 2.0
  • Created almost 16 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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 libidn11-dev # 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'

More Repositories

1

uuidtools

A simple universally unique ID generation library.
Ruby
424
star
2

nsq-k8s

NSQ setup for Kubernetes using Debian Jessie instead of Alpine to solve DNS issues.
25
star
3

redis-k8s

Redis cluster setup for Kubernetes using Debian Jessie.
Shell
22
star
4

aws-nmap

Scan Public/Elastic IPs on AWS with nmap.
Python
20
star
5

rill

Activity Streams parser for Ruby
Ruby
9
star
6

xbel

XBEL is the XML Bookmark Exchange Language library. This parser reads bookmarks from the various bookmark export formats used by browsers and web services and translates them to XBEL, CSV, JSON, or the HTML format used by Firefox.
Ruby
9
star
7

hardlock

Pure JavaScript proof-of-work for login pages using generalized birthday problem and SHA256.
JavaScript
8
star
8

retrieve

Retrieve is an extensible library for retrieving resources identified by a URI. Retrieval methods may be registered to URI schemes.
Ruby
8
star
9

httpadapter

A library for translating HTTP request and response objects for various clients into a common representation.
Ruby
7
star
10

salmon

An implementation of the Salmon Protocol for Ruby.
Ruby
6
star
11

hashbag

HashBag is a collection of useful specialized Hash subclasses.
Ruby
6
star
12

gentlerest

GentleREST is a lightweight web application framework for perfectionists. It is optimized for security, reliability, and speed, in that order. NOTE: Abandoned in favor of Sinatra.
Ruby
6
star
13

webfinger

An implementation of the WebFinger protocol for Ruby.
Ruby
4
star
14

xrd

An XRD parser and generator for Ruby.
Ruby
4
star
15

squish

Squish is an expirimental dynamic Markov compression classifier written in OCaml.
OCaml
4
star
16

skeleton

A simple project skeleton to use as a starting point for new gems.
Ruby
3
star
17

RMUD

RMUD is an Eclipse RCP based telnet client that uses JRuby for scripting.
Java
3
star
18

love

Ignore this repo, go to sporkmonger/mindigo instead.
Shell
3
star
19

chaingang

ChainGang is a drop-dead simple worker process framework.
Ruby
3
star
20

mrtd

Machine readable travel document parser; currently a working MESS
Ruby
2
star
21

gourmet

Gourmet is an import/export library for cookbooks and recipes.
Ruby
2
star
22

docker-kubelet

A Kubernetes Kubelet packaged up into an Alpine container
2
star
23

tabsweep

A Chrome extension meant to be a really easy way to manage overflowing tabs.
2
star
24

magicsig

An implementation of Magic Signatures for Ruby.
Ruby
2
star
25

eve-wingman

A utility for players of EVE Online.
2
star
26

autoparse

A dynamically generated parsing system using JSON Schema.
Ruby
2
star
27

grease

Grease is a Computerized Maintenance Management System (CMMS) designed primarily with vehicle maintenance in mind.
Ruby
2
star
28

ecsevent

HTTP observability middleware using the Elastic Common Schema
Go
2
star
29

sporkmonger.github.com

Code blog. I should get around to committing to it.
2
star
30

node-scrypt-js

Pure javascript implementation of scrypt
JavaScript
2
star
31

ifproxy

A reverse proxy for golang that allows requests to be blocked/aborted before being sent upstream.
Go
2
star
32

colour-schemes

Colour schemes for various text editors.
1
star
33

intercept

Intercept.js is a scriptable HTTP proxy that allows you to debug and rewrite traffic passing through it.
1
star
34

docker-golang-alpine-kubernetes

Go container based on janeczku/alpine-kubernetes:3.3 to allow DNS service discovery in k8s.
1
star
35

docker-kube2sky

Kubernetes-to-SkyDNS bridge customized for CoreOS
Shell
1
star
36

offgrid-js

An HTML5-based client-side database designed to synchronize with a server to provide rich offline access.
1
star
37

docker-kubernetes-ui

An Alpine-based Kubernetes UI container
1
star
38

datasciencecoursera

Course work for the Data Science specialization on Coursera
1
star
39

indigo-core

1
star
40

docker-skydns

SkyDNS customized for CoreOS
Shell
1
star
41

devise-pw-banlist

For use with the Database Authenticatable devise module, allows import of password banlists to ensure users do not adopt insecure or previously compromised passwords.
Ruby
1
star
42

docker-go

Base image for Go applications built on Alpine.
1
star
43

duet

A Rack web framework for building APIs. (very early code, doesn't do anything useful yet)
Ruby
1
star
44

dotfiles

My personal flavor of dotfiles.
Shell
1
star
45

mindigo

A minimal implementation in OCaml of the experimental language Indigo.
OCaml
1
star
46

instrument

Instrument is a simple library for producing dynamically generated "controls" with various templating languages.
Ruby
1
star
47

go-evidence

A library for working with evidence theory models.
Go
1
star