class Putcstst::CSVPrinter
class Error < StandardError; end
Public Class Methods
new(filepath)
click to toggle source
# File lib/putcstst.rb, line 8 def initialize(filepath) @file = filepath end
Public Instance Methods
print()
click to toggle source
# File lib/putcstst.rb, line 12 def print # 2D(2 column) Array Only CSV.foreach(@file) do |data| format = data.each_with_object("") do |_, str| str << "%10s" # str += "%10s" ## これはだめ。ふしぎ! # yieldの返り値が結合後にならないからなのかと思ったが # returnはちゃんと返されてる end puts sprintf(format, *data) end end