Permalink
Browse files

Implemented partial template expansions.

  • Loading branch information...
sporkmonger committed Apr 28, 2009
1 parent ad45047 commit ac09893e98ef6922ac2bf6962de1b757b5058d51
Showing with 938 additions and 105 deletions.
  1. +1 −0 CHANGELOG
  2. +6 −0 README
  3. +252 −105 lib/addressable/template.rb
  4. +679 −0 spec/addressable/template_spec.rb
View
@@ -6,6 +6,7 @@
* fixed unicode normalization exception
* improved specs
* refactored URI template support out into its own class
+ * added partial template expansion
* deprecated Addressable::URI.expand_template
* deprecated Addressable::URI#extract_mapping
* worked around issue with freezing URIs
View
6 README
@@ -27,6 +27,12 @@ Example usage:
})
#=> #<Addressable::URI:0xc9d95c URI:http://example.com/an+example+query/>
+ template = Addressable::Template.new(
+ "http://example.com/{-join|&|one,two,three}/"
+ )
+ template.partial_expand({"one" => "1", "three" => 3}).pattern
+ #=> "http://example.com/?one=1{-prefix|&two=|two}&three=3"
+
template = Addressable::Template.new(
"http://{host}/{-suffix|/|segments}?{-join|&|one,two,bogus}\#{fragment}"
)
Oops, something went wrong.

0 comments on commit ac09893

Please sign in to comment.