lib/seed-fu/writer.rb
def write(io_or_filename, &block)
      raise ArgumentError, "missing block" unless block_given?

      if io_or_filename.respond_to?(:write)
        write_to_io(io_or_filename, &block)
      else
        File.open(io_or_filename, 'w') do |file|
          write_to_io(file, &block)
        end
      end
    end
def write(io_or_filename, &block)
      raise ArgumentError, "missing block" unless block_given?

      if io_or_filename.respond_to?(:write)
        write_to_io(io_or_filename, &block)
      else
        File.open(io_or_filename, 'w') do |file|
          write_to_io(file, &block)
        end
      end
    end
def write ( io_or_filename , & block ) raise ArgumentError , "missing block" unless block_given? if io_or_filename . respond_to? ( :write ) write_to_io ( io_or_filename , block ) else File . open ( io_or_filename , 'w' ) do | file | write_to_io ( file , block ) end end end
Writes the necessary headers and footers, and yields to a block within which the actual
 seed data should be writting using the `#<<` method.

 @param [IO] io_or_filename The IO to which writes will be made. (If an `IO` is given, it is
   your responsibility to close it after writing.)
 @param [String] io_or_filename The filename of a file to make writes to. (Will be opened and
   closed automatically.)
 @yield [self] make calls to `#<<` within the block
Writes the necessary headers and footers and yields to a block within which the actual seed data should be writting using the #<< method .