Forums | Admin

Discussion Forums: open-discussion

Start New Thread Start New Thread

 

By: Erlend Simonsen
RE: Adding custom blocks within the parsers [ reply ]  
2007-10-19 16:20
Why not just copy the config.yaml to mine.yaml and do the modifications there?

Anyways, v0.07 will provide a ruby config again, in addition to the yaml format, which means that what you want to do will be easy and clean again. :-)

-- Erlend

By: Paul Cormier
Adding custom blocks within the parsers [ reply ]  
2007-10-19 15:26
So I've been working on a couple custom parsers for a project of mine, and I wanted to separate the definition of the blocks from the config file itself.
I also went through a bit of grief converting my 0.05 style block definitions to 0.06 yaml style definitions.

Anyway, long story short, adding the following to my parser classes (just before the parse method) sucessfully adds the new blocks I want to work with.

$CONFIG.blocks << { :name => 'repos', :position => :left, :order => 0, :size => 14, :auto_clean => false, :show => :total, :color => [0.0, 0.9, 0.0, 1.0] }
$CONFIG.blocks << { :name => 'message codes', :position => :left, :order => 1, :size => 15, :color => [0.0, 0.0, 0.8, 1.0] }
$CONFIG.blocks << { :name => 'target repos', :position => :right, :order => 0, :size => 16, :auto_clean => false, :show => :total, :color => [0.8, 0.0, 0.8, 1.0] }
$CONFIG.blocks << { :name => 'objects', :position => :right, :order => 1, :size => 15, :color => [0.8, 0.8, 0.0, 1.0] }

Feel free to let me know how to accomplish the same thing with cleaner Ruby code...

Paul