A summary of data about the Ruby ecosystem.

https://github.com/hannesg/uri_template

A URI template library for ruby.
https://github.com/hannesg/uri_template

Last synced: about 14 hours ago
JSON representation

Repository metadata

A URI template library for ruby.

README.md

URITemplate - a uri template library

Build Status
Dependency Status
Code Climate
Coverage

With URITemplate you can generate URIs based on simple templates and extract variables from URIs using the same templates. There are currently two syntaxes defined. Namely the one defined in RFC 6570 and a colon based syntax, similiar to the one used by sinatra.

From version 0.2.0, it will use escape_utils if available. This will significantly boost uri-escape/unescape performance if more characters need to be escaped ( may be slightly slower in trivial cases. working on that ... ), but does not run everywhere. To enable this, do the following:

# escape_utils has to be loaded when uri_templates is loaded
gem 'escape_utils'
require 'escape_utils'

gem 'uri_template'
require 'uri_template'

URITemplate::Utils.using_escape_utils? #=> true

Examples

require 'uri_template'

tpl = URITemplate.new('http://{host}{/segments*}/{file}{.extensions*}')

# This will give: http://www.host.com/path/to/a/file.x.y
tpl.expand('host'=>'www.host.com','segments'=>['path','to','a'],'file'=>'file','extensions'=>['x','y'])

# This will give: { 'host'=>'www.host.com','segments'=>['path','to','a'],'file'=>'file','extensions'=>['x','y']}
tpl.extract('http://www.host.com/path/to/a/file.x.y')

# If you like colon templates more:
tpl2 = URITemplate.new(:colon, '/:x/y')

# This will give: {'x' => 'z'}
tpl2.extract('/z/y')

# This will give a new uri template with just the host expanded:
tpl.expand_partial(host: "www.host.com")

RFC 6570 Syntax

The syntax defined by RFC 6570 is pretty straight forward. Basically anything surrounded by curly brackets is interpreted as variable.

URITemplate.new('{variable}').expand('variable' => 'value') #=> "value"

The way variables are inserted can be modified using operators. The operator is the first character between the curly brackets. There are seven operators defined #, +, ;, ?, &, / and .. So if you want to create a form-style query do this:

URITemplate.new('{?variable}').expand('variable' => 'value') #=> "?variable=value"

Benchmarks

I have assembled one benchmark based on the uritemplate-test examples. You can find them in the "benchmarks" folder. The short result: uri_template is 2-10x faster than addressable on ruby 1.9.3.


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: about 19 hours ago

Total Commits: 195
Total Committers: 7
Avg Commits per committer: 27.857
Development Distribution Score (DDS): 0.436

Commits in past year: 0
Committers in past year: 0
Avg Commits per committer in past year: 0.0
Development Distribution Score (DDS) in past year: 0.0

Name Email Commits
Hannes Georg h****g@g****m 110
HannesG h****g@i****e 48
Hannes Georg h****g@x****m 33
Peter Hellberg p****r@c****e 1
Bjørn Arild Mæland b****d@g****m 1
Ben Hollis b****n@b****t 1
Philip Vieira p****p@v****e 1

Committer domains:


Issue and Pull Request metadata

Last synced: 1 day ago

Total issues: 9
Total pull requests: 13
Average time to close issues: over 1 year
Average time to close pull requests: about 2 months
Total issue authors: 8
Total pull request authors: 12
Average comments per issue: 3.0
Average comments per pull request: 1.31
Merged pull request: 4
Bot issues: 0
Bot pull requests: 0

Past year issues: 0
Past year pull requests: 0
Past year average time to close issues: N/A
Past year average time to close pull requests: N/A
Past year issue authors: 0
Past year pull request authors: 0
Past year average comments per issue: 0
Past year average comments per pull request: 0
Past year merged pull request: 0
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/hannesg/uri_template

Top Issue Authors

  • bhollis (2)
  • mnot (1)
  • mateomurphy (1)
  • andrewpthorp (1)
  • peterhellberg (1)
  • andreypopp (1)
  • dblock (1)
  • plexus (1)

Top Pull Request Authors

  • Top-Chief (2)
  • Survivedabuse (1)
  • JsonXjames (1)
  • zeevallin (1)
  • bmaland (1)
  • bhollis (1)
  • jabulile99 (1)
  • tas50 (1)
  • miguel-botelho (1)
  • peterhellberg (1)
  • ivoanjo (1)
  • mslovelymiaboo (1)

Top Issue Labels

Top Pull Request Labels


Package metadata

gem.coop: uri_template

A templating system for URIs, which implements RFC6570 and Colon based URITemplates in a clean and straight forward way.

  • Homepage: http://github.com/hannesg/uri_template
  • Documentation: http://www.rubydoc.info/gems/uri_template/
  • Licenses: MIT
  • Latest release: 0.7.0 (published over 11 years ago)
  • Last Synced: 2025-12-15T10:10:18.047Z (1 day ago)
  • Versions: 17
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 46,488,309 Total
  • Docker Downloads: 487,449,304
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 0.183%
    • Docker downloads count: 0.205%
    • Downloads: 0.528%
  • Maintainers (1)
rubygems.org: uri_template

A templating system for URIs, which implements RFC6570 and Colon based URITemplates in a clean and straight forward way.

  • Homepage: http://github.com/hannesg/uri_template
  • Documentation: http://www.rubydoc.info/gems/uri_template/
  • Licenses: MIT
  • Latest release: 0.7.0 (published over 11 years ago)
  • Last Synced: 2025-12-15T10:10:15.241Z (1 day ago)
  • Versions: 17
  • Dependent Packages: 43
  • Dependent Repositories: 1,845
  • Downloads: 46,488,309 Total
  • Docker Downloads: 487,449,304
  • Rankings:
    • Docker downloads count: 0.268%
    • Downloads: 0.488%
    • Dependent packages count: 0.611%
    • Dependent repos count: 0.725%
    • Average: 1.475%
    • Forks count: 2.397%
    • Stargazers count: 4.358%
  • Maintainers (1)

Dependencies

Gemfile rubygems
  • addressable >= 0 development
  • coveralls >= 0 development
  • escape_utils >= 0 development
  • mutant >= 0 development
  • redcarpet >= 0 development
  • simplecov-console >= 0 development
Gemfile.lock rubygems
  • abstract_type 0.0.7
  • adamantium 0.2.0
  • addressable 2.3.5
  • anima 0.2.0
  • ast 1.1.0
  • atomic 1.1.16
  • colorize 0.7.0
  • concord 0.1.4
  • coveralls 0.7.0
  • descendants_tracker 0.0.3
  • diff-lcs 1.2.5
  • docile 1.1.3
  • equalizer 0.0.9
  • escape_utils 1.0.1
  • hirb 0.7.1
  • ice_nine 0.11.0
  • inflecto 0.0.2
  • memoizable 0.4.1
  • mime-types 2.2
  • morpher 0.2.0
  • multi_json 1.9.2
  • mutant 0.5.6
  • parser 2.1.7
  • procto 0.0.2
  • rake 10.1.1
  • redcarpet 3.1.1
  • rest-client 1.6.7
  • rspec 2.14.1
  • rspec-core 2.14.8
  • rspec-expectations 2.14.5
  • rspec-mocks 2.14.6
  • simplecov 0.8.2
  • simplecov-console 0.1.3
  • simplecov-html 0.8.0
  • slop 3.5.0
  • term-ansicolor 1.3.0
  • thor 0.18.1
  • thread_safe 0.2.0
  • tins 1.0.1
  • unparser 0.1.9
  • uri_template 0.7.0
  • yard 0.8.7.3
uri_template.gemspec rubygems
  • bundler >= 0 development
  • multi_json >= 0 development
  • rake >= 0 development
  • rspec >= 0 development
  • yard >= 0 development

Score: 27.927806038099025