From: Gavin Sinclair Date: 2012-01-26T09:50:11+09:00 Subject: Re: [ANN] "files" gem - for creating temporary files and dirs On Thu, Jan 26, 2012 at 7:13 AM, Joel VanderWerf wrote: > Here's another way to do it. (FSDB does a lot of other stuff, too...) Without looking, I'm going to guess that you created that library, Joel. That immediately assures me of its quality, but I found some of the API a little unwieldy. > > formats = [ >  FSDB::TEXT_FORMAT.when(/\.txt$|\.html$/), >  FSDB::BINARY_FORMAT.when(/\.png$/) > ] formats = { /\.txt$|\.html$/ => :text, /\.png$/ => :binary } # And should the programmer really have to specify these? Can't they be baked in? >  img["hello.png"] = data["hello.png"] I don't get a sense of what that line is doing. > # you can automatically serialize objects in yaml, json, or marshal: > [...] >  json_format = FSDB::Format.new( >    /\.json$/, /\.js$/, >    :name => "JSON_FORMAT", >    :load => proc {|f| JSON.load(f)}, >    :dump => proc {|object, f| f.syswrite(JSON.dump(object))} >  ) >  tmp.formats = formats + [FSDB::YAML_FORMAT, json_format] Seems to me that building yaml, json and marshal capabilities into the library would be justified and worthwhile. I'm starting work on a project involving a lot of file and directory manipulation, so I'll check out fsdb enthusiastically. Gavin