class BioTable::TableRow

Abstraction of a parsed table row (validation mostly)

Attributes

fields[R]
rowname[R]

Public Class Methods

new(rowname, fields = []) click to toggle source
# File lib/bio-table/tablerow.rb, line 6
def initialize rowname, fields = []
  @rowname = rowname
  @fields = fields
end

Public Instance Methods

all_fields() click to toggle source
# File lib/bio-table/tablerow.rb, line 15
def all_fields
  ([@rowname] << @fields).flatten
end
all_valid?() click to toggle source
# File lib/bio-table/tablerow.rb, line 19
def all_valid?
  all_fields != nil and all_fields.size > 0
end
append(values) click to toggle source
# File lib/bio-table/tablerow.rb, line 11
def append values
  @fields += values
end
match_all_fields?(zip) click to toggle source
# File lib/bio-table/tablerow.rb, line 27
def match_all_fields? zip
  row_fields = all_fields
  zip.each do | a |
    index = a[0]
    value = a[1]
    return false if row_fields[index] != value
  end
  true
end
valid?() click to toggle source
# File lib/bio-table/tablerow.rb, line 23
def valid?
  fields != nil and fields.size > 0
end