[ANN] RUnits 0.0.0 - basic unit conversions

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.
 
E

Edgardo Hames

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.
=20
Very quick (and inconsistent to show the diff instantiation options)
examples:
=20
50.to_meters + Distance.new(10, :cm) =3D> 50.1.meters
100.km > 100.to_miles =3D> false
=20

I already posted this comment on your website, but I send it to the
list just in case somebody wants to comment.

It would be nice to have alias for the US spelling of litre, i.e: liter.
Also, the British spelling of meter (metre) could be added to make it
more complete.

Cheers,
Ed
--=20
Encontr=E1 a "Tu psic=F3pata favorito" http://tuxmaniac.blogspot.com
=09
Thou shalt study thy libraries and strive not to reinvent them without caus=
e,
that thy code may be short and readable and thy days pleasant and productiv=
e.
-- Seventh commandment for C programmers
 
R

Richard Livsey

Edgardo said:
It would be nice to have alias for the US spelling of litre, i.e: liter.
Also, the British spelling of meter (metre) could be added to make it
more complete.
Thanks.

I'll add these in this evening. I must admit I was a bit inconsistant at
my naming of the aliases - IE I used the American meter but the British
litre! That's 4am coding for you.

Still confused about what to do for the default 'gallon' as, unlike ton
and tonne, there is no difference in the spelling of metric and imperial
versions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

[ANN] QuiXML 0.0.0 11
[ANN] RedParse 0.8.4 Released 0
[ANN] Ruby Units 15
[ANN] redparse 0.8.1 Released 0
[ANN] RedParse 0.8.0 released 0
[ANN] xx-2.0.0 10
[ANN] Halcyon 0.4.0 0
[ANN] Halcyon 0.3.18 Release 0

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top