Cache some sheet info for a small speedup while searching.

This commit is contained in:
John Bintz 2014-09-30 08:55:21 -04:00
parent 632be845cb
commit ff3d4ee51c

View File

@ -13,7 +13,7 @@ module SVGGVS
def settings def settings
settings = {} settings = {}
doc.each_with_pagename do |name, sheet| sheets.each do |name, sheet|
if name['SVGGVS Settings'] if name['SVGGVS Settings']
sheet.each do |setting, value| sheet.each do |setting, value|
settings[setting.spunderscore.to_sym] = value settings[setting.spunderscore.to_sym] = value
@ -24,8 +24,20 @@ module SVGGVS
settings settings
end end
def each_card(card_sheet_identifier) def sheets
return @sheets if @sheets
@sheets = []
doc.each_with_pagename do |name, sheet| doc.each_with_pagename do |name, sheet|
@sheets << [ name, sheet.dup ]
end
@sheets
end
def each_card(card_sheet_identifier)
sheets.each do |name, sheet|
if name[card_sheet_identifier] if name[card_sheet_identifier]
headers = sheet.row(1) headers = sheet.row(1)