samg / timetrap

Simple command line timetracker
http://rubygems.org/gems/timetrap
Other
1.49k stars 116 forks source link

Custom Formatters should be able to reference built in formatters. #36

Closed gregwebs closed 13 years ago

gregwebs commented 13 years ago

I assume this means they should be loaded after the built in formatters.

samg commented 13 years ago

Thanks for pointing this out.

When I added the custom formatter functionality I made it so that all the formatter classes are lazily required. This has a few advantages (e.g. faster load times), but does mean that they need to be explicitly required by formatters that depend on them.

The environment should set up the load path such that you can:

require 'timetrap/formatters/text'

instead of the absolute path. This should make your code much more portable.

I could also handle this more dynamically within timetrap, using #const_missing to attempt to load formatter classes that are referenced. This would remove the necessity to require the classes. I'll think about adding this to a future release.

Thanks!