Method: CSV::Table#by_col!
- Defined in:
- lib/csv/table.rb
#by_col! ⇒ Object
:call-seq:
table.by_col! -> self
Sets the mode for self to column mode (see Column Mode); returns self:
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
257 258 259 260 261 |
# File 'lib/csv/table.rb', line 257 def by_col! @mode = :col self end |