Shared utils for Studitemp's Ruby projects.


TravisCI codecov Depfu Maintainability Inline docs


Add this line to your application's Gemfile:

gem 'studitemps-utils'

And then execute:

$ bundle

Or install it yourself as:

$ gem install studitemps-utils


An Studitemps Utils URI references similar to a normal URI a specific resource. It contains at least a schema but most of the time when used to reference a resource it also has a context, resource, and an id.

Example: com.example:billing:invoice:R422342

  • schema: com.example - Some kind of schema to make URI globally unique.
  • context: billing - The context the URI (and the resource) belongs to.
  • resource: invoice - The resource type.
  • id: R422342 - The resource id.


require 'studitemps/utils/uri'

MyBaseURI = 'com.example')
InvoiceURI = MyBaseURI, context: 'billing', resource: 'invoice')

uri = 'R422342') # => #<InvoiceURI 'com.example:billing:invoice:R422342'>
uri.to_s # => 'com.example:billing:invoice:R422342''com.example:billing:invoice:R422342') # => #<InvoiceURI 'com.example:billing:invoice:R422342'> 'R422342') # => #<InvoiceURI 'com.example:billing:invoice:R422342'> # => #<InvoiceURI 'com.example:billing:invoice:R422342'>


Extensions add additional functionality to URIs. They can be used by requiring them before building the URI classes.

require 'studitemps/utils/uri/extensions/serialization'

MyBaseURI = 'com.example')
uri = 'billing', resource: 'invoice', id: 'R422342')

MyBaseURI.dump(uri) # => 'com.example:billing:invoice:R422342'
MyBaseURI.load('com.example:billing:invoice:R422342') # =>  #<MyBaseURI 'com.example:billing:invoice:R422342'>

Available Extensions


After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install.


Bug reports and pull requests are welcome on GitHub at


The gem is available as open source under the terms of the MIT License.