class Asciidoctor::Table

def initialize parent, attributes

def initialize parent, attributes
  super parent, :table
  @rows = Rows.new
  @columns = []
  @has_header_option = false
  # smells like we need a utility method here
  # to resolve an integer width from potential bogus input
  if (pcwidth = attributes['width'])
    if (pcwidth_intval = pcwidth.to_i) > 100 || pcwidth_intval < 1
      pcwidth_intval = 100 unless pcwidth_intval == 0 && (pcwidth == '0' || pcwidth == '0%')
    end
  else
    pcwidth_intval = 100
  end
  @attributes['tablepcwidth'] = pcwidth_intval
  if @document.attributes['pagewidth']
    @attributes['tableabswidth'] = (abswidth_val = (((pcwidth_intval / 100.0) * @document.attributes['pagewidth'].to_f).truncate DEFAULT_PRECISION)) == abswidth_val.to_i ? abswidth_val.to_i : abswidth_val
  end
  @attributes['orientation'] = 'landscape' if attributes['rotate-option']
end