class TableTransform::Table::Row

Table row Columns within row can be referenced by name, e.g. row

Public Class Methods

new(cols, row) click to toggle source
# File lib/table_transform/table.rb, line 163
def initialize(cols, row)
  @cols = cols #column name and index in row
  @row  = row  #Specific row data
end

Public Instance Methods

[](column_name) click to toggle source

@returns row value with column name or empty string if it does not exist @throws exception if column name does not exist

# File lib/table_transform/table.rb, line 170
def [](column_name)
  index = Util::get_col_index(column_name, @cols)
  Cell.new @row[ index ].to_s || ''
end