Before I started using Ruby, I coded mostly with PHP. Back then, I worked a lot with Symfony2 and its web profiler.
I found it really nice and I’m surprised that nothing similar exists in Ruby and Ruby on Rails.
So I decided to create one.
I’m currently working on it. I mainly would like to provide a nice an simple DSL to allow everybody
to create and register their own collector(s).
Create a collector
Until now I’m thinking about creating DSL1 like the examples right after.
As a lot of libraries and tools, it’s a nice way to allow externals extended.
To start prototyping I worked with classic classes. But I guess it’s a nice instant to move in a DSL way.
So, here are the two ways I think are interesting.
DSL with template file
The erb template could look like this. By using the content_for method.
I’m not sure yet about the template part. It might be better to
have DSL methods into the collector instead of a template.
With something like this:
Register a collector
It’s nice to create a collector but we also have to register it. It’s why I prepared some code to allow it.
Into an app
Then with the collector the idea is just to register it as this.
Into a gem
But also it allow gems to contain their own collector(s).
In my opinion the template file is nicer to management html. At least if the html to generate is big.
But have the content into the collector class is simpler because we only have one file.