Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

virtus + ruby-units integration

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Gemfile
Octocat-spinner-32 README.markdown
Octocat-spinner-32 Rakefile
Octocat-spinner-32 virtus-units.gemspec
README.markdown

Virtus Units

This is a set of custom virtus attributes that use ruby-units to convert between different units of measure.

The project is currently only a code spike, a proof of concept. We'll see how it goes.

API

It can look more or less like this:

class WaterPool
  include Virtus

  attribute :capacity, Volume, :input_unit => :gallon, :output_unit => :liter
end

water_pool = WaterPool.new(:capacity => 10000)
water_pool.capacity # 37854.118
Something went wrong with that request. Please try again.