From: Jamis Buck Date: 2005-08-19T06:45:22+09:00 Subject: Re: domain-specific language On Aug 18, 2005, at 3:40 PM, Joe Van Dyk wrote: > I'm writing an application that controls a group/cluster of linux > computers/nodes. I need to have a configuration file that lists the > nodes in the cluster. > > It would be neat if the configuration file was in Ruby. If I had > nodes named node1 and node3, the configuration file could look a > little like: > > node :node1 do > ip 192.whatever > title "Node 1" > end > > node :node2 do > ip 192.whatever > title "Node 2" > end > > So, is there some standard Ruby idiom for how to read a file and > execute the code? Just load the file and instance_eval it? That's what SwitchTower does. I'm sure there's many other ways to do it, but it works well enough. - Jamis