Skip to content

Commit

Permalink
Updated README to include more example code.
Browse files Browse the repository at this point in the history
  • Loading branch information
sporkmonger committed Nov 18, 2008
1 parent 2263560 commit 8431880
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions README
Expand Up @@ -14,11 +14,25 @@ Example usage:
uri.path
#=> "/path/to/resource/"

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

Addressable::URI.expand_template("http://example.com/{-list|+|query}/", {
"query" => "an example query".split(" ")
})
#=> #<Addressable::URI:0xc9d95c URI:http://example.com/an+example+query/>

uri = Addressable::URI.parse("http://www.詹姆斯.com/")
uri.normalize
#=> #<Addressable::URI:0xc9a4c8 URI:http://www.xn--8ws00zhy3a.com/>
Addressable::URI.parse(
"http://example.com/a/b/c/?one=1&two=2#foo"
).extract_mapping(
"http://{host}/{-suffix|/|segments}?{-join|&|one,two,bogus}\#{fragment}"
)
#=>
# {
# "host" => "example.com",
# "segments" => ["a", "b", "c"],
# "one" => "1",
# "two" => "2",
# "fragment" => "foo"
# }

0 comments on commit 8431880

Please sign in to comment.