End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
CSV::Table#by_col!
table.by_col! → self
lib/csv/table.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.1.3/lib/csv/table.rb, line 257
def by_col!
@mode = :col
self
end
Sets the mode for self to column mode (see Column Mode); returns self:
Example
source = "Name,Value\nfoo,0\nbar,1\nbaz,2\n" table = CSV.parse(source, headers: true) table.mode # => :col_or_row table1 = table.by_col! table.mode # => :col table1.equal?(table) # => true # Returned self