R
Richard Livsey
I had the need to implement some unit conversions and so used it as an
opportunity to learn a bit more Ruby than I know through my exposure via
Rails.
I've ended up with a very simple module which has probably already been
implemented a bunch of times by different people, but it was a good
learning exercise.
I've very much appreciate any feedback on the code, is it any good
etc... so that I can improve it and any further code.
Very quick (and inconsistent to show the diff instantiation options)
examples:
50.to_meters + Distance.new(10, :cm) => 50.1.meters
100.km > 100.to_miles => false
There's more details on this post.
http://livsey.org/2005/09/12/ruby-units
Direct link to the code, but there's currently no docs so I'd recommend
going via the post anyway.
http://livsey.org/experiments/ruby/runits-0.0.0.zip
Thanks.
opportunity to learn a bit more Ruby than I know through my exposure via
Rails.
I've ended up with a very simple module which has probably already been
implemented a bunch of times by different people, but it was a good
learning exercise.
I've very much appreciate any feedback on the code, is it any good
etc... so that I can improve it and any further code.
Very quick (and inconsistent to show the diff instantiation options)
examples:
50.to_meters + Distance.new(10, :cm) => 50.1.meters
100.km > 100.to_miles => false
There's more details on this post.
http://livsey.org/2005/09/12/ruby-units
Direct link to the code, but there's currently no docs so I'd recommend
going via the post anyway.
http://livsey.org/experiments/ruby/runits-0.0.0.zip
Thanks.