J
Jeremy Evans
ThirdBase is a replacement for Ruby's standard Date/DateTime
classes, with the following differences:
- ThirdBase is roughly 2-10 times faster depending on usage
- ThirdBase has a lower memory footprint
- ThirdBase supports pluggable parsers
- ThirdBase doesn't depend on Ruby's Rational class
- ThirdBase always uses the gregorian calendar
The 1.2.0 release of ThirdBase makes it much easier to add custom
parsers. Custom parsers can now be specified via a strptime
format string:
DateTime.add_parserus, '%Z %m~%Y~%d %S`%M`%H')
DateTime.parse('PDT 02~2009~28 15`45`12')
=> #<DateTime 2009-02-28T12:45:15-07:00>
With a strptime-based parser, you don't need to provide a block,
as the parser block is created for you.
You can still use the old Regexp-style parsers, and now they can
return a Date/DateTime instance directly, they are no longer
required to return a hash that is given to new!.
An additional default parser was added so the following can be
handled correctly:
DateTime.parse(Time.now.to_s)
DateTime.parse(Time.now.strftime('%+'))
The named timezones supported by Ruby's Time class are now
supported by ThirdBase (e.g. PST, EDT, UTC).
The %z strptime/strftime format string modifier now operates more
closely to standard ruby.
Enjoy,
Jeremy
- website {http://third-base.rubyforge.org/}
classes, with the following differences:
- ThirdBase is roughly 2-10 times faster depending on usage
- ThirdBase has a lower memory footprint
- ThirdBase supports pluggable parsers
- ThirdBase doesn't depend on Ruby's Rational class
- ThirdBase always uses the gregorian calendar
The 1.2.0 release of ThirdBase makes it much easier to add custom
parsers. Custom parsers can now be specified via a strptime
format string:
DateTime.add_parserus, '%Z %m~%Y~%d %S`%M`%H')
DateTime.parse('PDT 02~2009~28 15`45`12')
=> #<DateTime 2009-02-28T12:45:15-07:00>
With a strptime-based parser, you don't need to provide a block,
as the parser block is created for you.
You can still use the old Regexp-style parsers, and now they can
return a Date/DateTime instance directly, they are no longer
required to return a hash that is given to new!.
An additional default parser was added so the following can be
handled correctly:
DateTime.parse(Time.now.to_s)
DateTime.parse(Time.now.strftime('%+'))
The named timezones supported by Ruby's Time class are now
supported by ThirdBase (e.g. PST, EDT, UTC).
The %z strptime/strftime format string modifier now operates more
closely to standard ruby.
Enjoy,
Jeremy
- website {http://third-base.rubyforge.org/}