Method: MyMatrix#to_text
- Defined in:
- lib/mymatrix.rb
#to_text(outFile) ⇒ Object
使い方はto_t()を参照。yield。
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 |
# File 'lib/mymatrix.rb', line 386 def to_text(outFile) outFile = FileIO.encodePath(outFile) out = [] out << @headers @mx.each do |row| out << row end begin fo = open(outFile, 'wb') rescue => e p "cannot write file...#{outFile}" p e sleep(5) retry end out.each_with_index do |row, i| if(row == nil) warn("line #{i} is nil") fo.print("") else str = yield(row) fo.print(str) end fo.print("\r\n") end fo.close end |