class PCGS::Table
Attributes
coin_grade_type[RW]
coin_type[RW]
doc[RW]
rows[RW]
tab[RW]
Public Class Methods
new(coin_type, tab, coin_grade_type, doc)
click to toggle source
# File lib/pcgs.rb, line 103 def initialize(coin_type, tab, coin_grade_type, doc) @coin_type = coin_type @tab = tab @coin_grade_type = coin_grade_type @rows = [] @doc = doc end
Public Instance Methods
add_row(coin_subtype, elements, header_row)
click to toggle source
# File lib/pcgs.rb, line 111 def add_row(coin_subtype, elements, header_row) row = PCGS::Row.new(coin_subtype, elements, header_row) self.rows << row row end
add_rows(rows)
click to toggle source
# File lib/pcgs.rb, line 117 def add_rows(rows) if not rows.empty? table = self length = rows.first.size subtype = table.coin_type header_row = nil hh = "<img src=\"images/expand.gif\" align=\"left\" class=\"expandcollapseimages\" border=\"0\" />" rows.each do |row| if row.size == length if row.first.to_s.include?(hh) row[0] = row[0].gsub(hh,"").to_i end if row.first.is_a?(Integer) table.add_row(subtype, row, header_row) elsif row.first[0..3] == "PCGS" header_row = table.add_row("Header", row, nil) end elsif row.size == 1 if row.first.include?("Price Changes") && rows[1].first.include?("Collectors Corner") subtype = row.first.split(",")[0] end end end end end