Ruby as configuration language

Another nice thing about ruby - it can be used as good looking configuration language.

Let’s consider simple “menu” application. Menu structure can be kept in such a file:

iconSize MENU
item {
        name "Terminal"
        icon "gnome-terminal"
        action { execute "gnome-terminal" }
}
item {
        name "x-chat"
        icon "xchat.ico"
        action { execute "xchat2" }
}
item {
        name "games"
        icon "games.ico"

        # nested items !!!
        item {
                name "wesnoth"
        }
        item {
                name "bzflag"
        }
}

Clean, simple, human readable. But the best thing is - it’s just a ruby program. Alone it doesn’t make any sense. But being run in appropriate environment - it will create an object/parameter tree that you can use to read data.
I wrote simple program to demonstrate this. It’s called GTK Menu.
Run it with configuration file as a parameter. Nothing will appear. You have to SIGHUP it. Whenever you send a HUP signal to it, menu will pop up offering you the choices you described in configuration file.
How is it done? Currently - the ugliest way possible :) I wrote it 2 years ago. Back then I didn’t know ruby even more than I don’t know it right now. But it works.
Source attached, good luck!

downloads:

screenshots: