From e366b0c1b2a572ef57eb1c2e4a7c498452c9c37b Mon Sep 17 00:00:00 2001 From: John Bintz Date: Sat, 1 Mar 2014 11:03:54 -0500 Subject: [PATCH] Be able to specify sheet names that are read for card data in each Cardfile --- lib/svggvs/data_source.rb | 4 ++-- lib/svggvs/session.rb | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/svggvs/data_source.rb b/lib/svggvs/data_source.rb index 3442cbf..98e1d72 100644 --- a/lib/svggvs/data_source.rb +++ b/lib/svggvs/data_source.rb @@ -24,9 +24,9 @@ module SVGGVS settings end - def each_card + def each_card(card_sheet_identifier) doc.each_with_pagename do |name, sheet| - if name['Card Data'] + if name[card_sheet_identifier] headers = sheet.row(1) (sheet.first_row + 1).upto(sheet.last_row) do |index| diff --git a/lib/svggvs/session.rb b/lib/svggvs/session.rb index dd51b6f..b15ca54 100644 --- a/lib/svggvs/session.rb +++ b/lib/svggvs/session.rb @@ -3,9 +3,11 @@ module SVGGVS attr_accessor :svg_source, :svg_merged_target, :individual_files_path, :on_card_finished attr_accessor :png_files_path, :png_export_width, :pdf_card_size, :pdf_dpi attr_accessor :pdf_target, :card_back, :card_size, :target, :post_read_data + attr_accessor :card_sheet_identifier def initialize @index = 0 + @card_sheet_identifier = "Card Data" end def configure @@ -58,7 +60,7 @@ module SVGGVS settings_from_hash(data_source.settings) @process = proc do - data_source.each_card do |card| + data_source.each_card(card_sheet_identifier) do |card| if !!@post_read_data @post_read_data.call(card) end