class Gauge::Row

Holds a row of a table. @api public

Public Class Methods

new(columns, values) click to toggle source

@api private

# File lib/table.rb, line 70
def initialize(columns, values)
  @values = values
  @columns = columns
end

Public Instance Methods

[](index) click to toggle source

Gets the row cell. @param index Either cell index, or Column name. @return [string] value of the row cell @example

row[0] => 'value'
row['column'] => 'value'
row[i] => nil # when index is out of range
# File lib/table.rb, line 82
def [](index)
  return @values[index] if index.is_a?(Integer)
  columns_index = @columns.index(index)
  columns_index.nil? ? nil : @values[columns_index]
end