def write_file(filename = nil)
      filename ||= @filename
      unless filename.is_a?(String)
        raise ArgumentError, "Called write_file() for fact_index without a filename"
      end
      File.open(filename, "w") { |f| f.write(to_yaml) }
    end
def write_file(filename = nil)
      filename ||= @filename
      unless filename.is_a?(String)
        raise ArgumentError, "Called write_file() for fact_index without a filename"
      end
      File.open(filename, "w") { |f| f.write(to_yaml) }
    end
Write the fact index out to a YAML file.

 filename - A String with the file to write (defaults to filename from constructor if available)