lib/optimiser/dependency_builder.rb in rubyfromexcel-0.0.4 vs lib/optimiser/dependency_builder.rb in rubyfromexcel-0.0.5
- old
+ new
@@ -15,10 +15,11 @@
self.dependencies.uniq.sort
end
def sheet_reference(sheet_name,reference)
sheet_name = $1 if sheet_name.to_s =~ /^(\d+)\.0+$/
+ puts "Warning, #{formula_cell} refers to an external workbook in '#{sheet_name}'" if sheet_name =~ /^\[\d+\]/
using_worksheet(SheetNames.instance[sheet_name]) do
reference.visit(self)
end
end
@@ -57,28 +58,28 @@
end
def function(name,*args)
if name == "INDIRECT"
args.first.visit(self)
- dependencies_for FormulaBuilder.new(formula_cell).indirect_function(args.first)
+ d = dependencies_for(FormulaBuilder.new(formula_cell).indirect_function(args.first))
else
args.each { |a| a.visit(self) }
end
end
def reference_for_name(name)
worksheet.named_references[name.to_method_name] ||
workbook.named_references[name.to_method_name] ||
- (raise Exception.new("#{name} not found"))
+ (raise Exception.new("#{name} in #{formula_cell} not found"))
end
def workbook
formula_cell.worksheet.workbook
end
def using_worksheet(sheet_name)
original_worksheet = self.worksheet
- self.worksheet = workbook.worksheets[sheet_name] || (raise Exception.new("#{sheet_name} not found"))
+ self.worksheet = workbook.worksheets[sheet_name] || (raise Exception.new("#{sheet_name} in #{formula_cell} not found"))
yield
self.worksheet = original_worksheet
end
end
\ No newline at end of file