<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -41,49 +41,51 @@ module IMW
       }
         
       def initialize path, mode='r', options = {}
-        self.path= path
-        options.reverse_merge!(self.class::DEFAULT_OPTIONS)
-        super File.new(@path,mode),options
+        options.reverse_merge!(self.class::DEFAULT_OPTIONS)        
+        if File.exist?(File.expand_path(path)) then
+          self.path= path
+          super File.new(@path,mode),options
+        else
+          super path,options
+        end
       end
 
       # Return the contents of this CSV file as an array of arrays.
-      # If given a block, then yield each row of the outer array to
-      # the block.
-      def load &amp;block
-        if block
-          each_line {|line| yield line}
-        else
-          entries
-        end
+      def load
+        entries
       end
 
-      # Dump +data+ to this file.  Will close the I/O stream for this
-      # file.
+      # Dump +data+ to this file.
       #
-      # FIXME should we have an option here to not close the I/O
-      # stream but leave it open for further dumping until someone
-      # calls +close+?
-      def dump data
+      # Options include:
+      # &lt;tt&gt;:flush&lt;/tt&gt; (true):: flush the file buffer, writing it to disk
+      # &lt;tt&gt;:close&lt;/tt&gt; (true):: close the file after writing +data+
+      def dump data, options = {}
+        options.reverse_merge!({:close =&gt; true, :flush =&gt; true})
         data.each {|row| self &lt;&lt; row}
-        self.close
+        self.flush if options[:flush]
+        self.close if options[:close]
+        self
       end
     end
 
     # Represents a file of comma-separated values (CSV).  This class
     # is a subclass of &lt;tt&gt;FasterCSV&lt;/tt&gt; so the methods of that
     # library are available for use.
+    #
+    # See &lt;tt&gt;IMW::Files::TabularDataFile&lt;/tt&gt; for more complete
+    # documentation.
     class Csv &lt; TabularDataFile
     end
 
     # Represents a file of tab-separated values (TSV).  This class
     # is a subclass of &lt;tt&gt;FasterCSV&lt;/tt&gt; so the methods of that
     # library are available for use.
+    #
+    # See &lt;tt&gt;IMW::Files::TabularDataFile&lt;/tt&gt; for more complete
+    # documentation.
     class Tsv &lt; TabularDataFile
-
-      # Default options to be passed to
-      # FasterCSV[http://fastercsv.rubyforge.org/]; see its
-      # documentation for more information.
-      DEFAULT_OPTIONS[:col_sep] = &quot;\t&quot;
+      DEFAULT_OPTIONS = {:col_sep =&gt; &quot;\t&quot;}.reverse_merge DEFAULT_OPTIONS
     end
 
     FILE_REGEXPS[Regexp.new(&quot;\.csv$&quot;)] = IMW::Files::Csv</diff>
      <filename>lib/imw/files/csv.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>705d862e39e7001de431fc5562f811a7ae9f99fa</id>
    </parent>
  </parents>
  <author>
    <name>Dhruv Bansal</name>
    <email>dhruv@ph.utexas.edu</email>
  </author>
  <url>http://github.com/infochimps/imw/commit/fa7dbf3496bc0a1f6fa8b7ae105f0479563abfdc</url>
  <id>fa7dbf3496bc0a1f6fa8b7ae105f0479563abfdc</id>
  <committed-date>2009-01-27T13:48:58-08:00</committed-date>
  <authored-date>2009-01-27T13:48:58-08:00</authored-date>
  <message>Redid the way in which IMW::Files::Csv and IMW::Files:Tsv subclass IMW::Files:TabularDataFile so that things work as expected (i.e. - the :col_sep property is not shared between Csv and Tsv though everything else is...)</message>
  <tree>b0edb1600ed360671e9792f4d09c80bda3f3fe53</tree>
  <committer>
    <name>Dhruv Bansal</name>
    <email>dhruv@ph.utexas.edu</email>
  </committer>
</commit>
