From: Dreamcat Four Date: 2010-03-10T19:53:35+09:00 Subject: Best / cleanest DSL for manipulating data files? Hi, At the stage of implementing the interface for a new RubyGem. The main goal is to make something that is intuitive, easy to use. Its a library for manipulating apple plists. So really we are just manipulating a file, BUT its of a certain type and predifined structure. The current feature set includes: * Read, write, and edit (modify-in-place) * Can remember operations, but act later (passing in a block), then calling 'finalize', 'close' or something when the work is to be done. * Different *types* of plist. Like we can restrict our valid data if our Plist is for Launchd, or an Appbundle's Info.plist * Whether binary or xml can be autodetected on read. But want to provide an option to specify how to write. I don't really know if that should be a seperate class, method, or just an optional parameter? * Maybe a couple of global options (or not!) Like whether to override / enable the subtypes (Info,Launchd) and their validation. Another possible option is to allow users to override the default backend and specify their own "backend" to use. * Have already decided / implemented for users to manipulate their plist data through the familiar ruby block syntax. eg `plist do setter_methods.. end`. So im not going to change that part. This exercise is more about avoiding confusion and providing the neatest possible interface. In previous work, i have never felt completely comfortable passing hashes to the initializer for options. Its just something im not very experienced at doing. But that, or anything else to make life easier for my users. Guessing that some of you might yawn and think "ive seen this all before somewhere else". Well its exactly you guys i need to talk to! -- Posted via http://www.ruby-forum.com/.