Class: TableTransform::Table::Row

Inherits:
Object
  • Object
show all
Defined in:
lib/table_transform/table.rb

Overview

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

Instance Method Summary collapse

Constructor Details

#initialize(cols, row) ⇒ Row

Returns a new instance of Row.



160
161
162
163
# File 'lib/table_transform/table.rb', line 160

def initialize(cols, row)
  @cols = cols #column name and index in row
  @row  = row  #Specific row
end

Instance Method Details

#[](column_name) ⇒ Object



167
168
169
170
# File 'lib/table_transform/table.rb', line 167

def [](column_name)
  index = Util::get_col_index(column_name, @cols)
  Cell.new @row[ index ].to_s || ''
end