I've been using some Number extensions of my own for some time:
Number.seconds, Number.minutes, Number.hours etc. where (2).minutes()
would return the 2 minutes expressed as milliseconds e.g. 120000,
(2).seconds() would return 2000 etc.

It's been great for defining config files e.g.:

Config.Database.recentThreshold = (2).minutes();
Config.Http.timeout = (60).seconds();

I think Rails does the same and that may be where I got the idea from.
I've also added Number.kilobytes, Number.megabytes, etc.

It would be great if interfaces which receive a time or quantity value
as an option, such as PeriodicalExecuter, could expect the value to be
expressed in the lowest common denominator unit practical, i.e.
milliseconds rather than seconds. Java does it, and so does
Javascript's own setInterval, setTimeout etc. It would follow the
principle of least surprise and make units of measurement easier to
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to