[ANN] MutableTime class

G

Gavin Kistner

I've just finished my first general-purpose Ruby class, MutableTime.

You can read the RDocs for it at http://phrogz.net/RubyLibs/ (and you
can download it from the link at the bottom of the page for the
MutableTime.rb file)

What is MutableTime? It arose out of my desire for a Date/Time class in
Ruby that behaves like the Date object in JS. From the MutableTime docs:

-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-

The MutableTime class behaves much like the builtin Time class, except:

* almost any property can be changed, e.g.
mmTime = MutableTime.new
mmTime.year = 1973
mmTime.month += 13

* by default, month numbers start at 0 instead of 1
— see monthsStartAtZero?

* you can choose if the first day of the week is Sunday or Monday
— see weekStartsOnMonday?

* it has convenience methods named similar to JavaScript’s Date object
— fullYear, month, date, hours, minutes, seconds

* customFormat is slightly more powerful than Time#strftime

* you can easily internationalize the month and day names
(without editing the source code for the class)

-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-

Please try it out and tell me what you think.

Also...what's the standard protocol for releasing new classes like this?
Is there somewhere that I should upload the .rb file to? Somewhere other
than here that I should announce it?
 
T

Tim Hunter

Also...what's the standard protocol for releasing new classes like this?
Is there somewhere that I should upload the .rb file to? Somewhere other
than here that I should announce it?

RubyForge
 

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

Members online

Forum statistics

Threads
474,142
Messages
2,570,820
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top