class NamedReferences

Attributes

named_references[RW]
table_data[RW]

Public Class Methods

new(refs, tables = {}) click to toggle source
# File src/simplify/replace_named_references.rb, line 5
def initialize(refs, tables = {})
  @named_references = refs
  @table_data = tables
  @deepCopyCache = {}
end

Public Instance Methods

deep_copy(ast) click to toggle source
# File src/simplify/replace_named_references.rb, line 24
def deep_copy(ast)
  return ast if ast.is_a?(Symbol)
  return ast if ast.is_a?(Numeric)
  return ast.dup unless ast.is_a?(Array)
  ast.map do |a|
    deep_copy(a)
  end
end
reference_for(sheet,named_reference) click to toggle source
# File src/simplify/replace_named_references.rb, line 11
def reference_for(sheet,named_reference)
  sheet = sheet.downcase
  named_reference = named_reference.downcase.to_sym
  ref = @named_references[[sheet, named_reference]] ||
  @named_references[named_reference] ||
  @table_data[named_reference] ||
  [:error, :"#NAME?"]
  return @deepCopyCache[ref] if @deepCopyCache.key?(ref)
  copy = deep_copy(ref)
  @deepCopyCache[ref] = copy
  return copy
end