class RemoveCells

Attributes

cells_to_keep[RW]

Public Class Methods

rewrite(*args) click to toggle source
# File src/simplify/remove_cells.rb, line 6
def self.rewrite(*args)
  self.new.rewrite(*args)
end

Public Instance Methods

delete_ref?(ref) click to toggle source
# File src/simplify/remove_cells.rb, line 17
def delete_ref?(ref)
  sheet = ref.first
  cell = ref.last
  cells_to_keep_in_sheet = cells_to_keep[sheet]
  return true unless cells_to_keep_in_sheet
  return false if cells_to_keep_in_sheet.has_key?(cell)
  true
end
rewrite(formulae) click to toggle source
# File src/simplify/remove_cells.rb, line 10
def rewrite(formulae)
  formulae.delete_if do |ref, ast|
    delete_ref?(ref)
  end
  formulae
end