On Tue, Oct 06, 2009 at 02:41:20PM -0500, Nathan Neff wrote:
I changed my config.yaml to look like this:

<snip>
   ${mod}-c: | # focus client chosen from a menu
     client = client_menu('invite client:') and client.tag curr_tag

</snip>

Thank you very much!  I'm going to delve further into your wmiirc
stuff using the interactive prompt.  I don't quite understand how
config.yaml
gets turned into "real" ruby code, but will check out the tutorials on the
website:
http://snk.tuxfamily.org/lib/rumai/

Black magic... black magic.

Basically, YAML is the same thing as S-exprs or XML. It represents a tree of nodes. Ruby mangles it into a tree of hash maps (or whatever ruby calls them). It processes certain nodes specially --- basically, it just evals them. Keys, for instance, go something like this:

    CONFIG['control']['key'].each { |k, v|
        bind_key k *(eval "sub { |key| #{v} }")
    }

I'd personally probably stick with pure ruby, but the config.yaml mangling is straightforward enough.

--
Kris Maglione

If you don't think carefully, you might think that programming is just
typing statements in a programming language.
        --Ward Cunningham


Reply via email to