class AstCopyFormula

Constants

DO_NOT_MAP

Attributes

columns_to_move[RW]
rows_to_move[RW]

Public Class Methods

new() click to toggle source
# File src/rewrite/ast_copy_formula.rb, line 8
def initialize
  self.rows_to_move = 0
  self.columns_to_move = 0
end

Public Instance Methods

area(start,finish) click to toggle source
# File src/rewrite/ast_copy_formula.rb, line 32
def area(start,finish)
  s = Reference.for(start).offset(rows_to_move,columns_to_move)
  f = Reference.for(finish).offset(rows_to_move,columns_to_move)
  [:area,s,f]
end
cell(reference) click to toggle source
# File src/rewrite/ast_copy_formula.rb, line 27
def cell(reference)
  r = Reference.for(reference)
  [:cell,r.offset(rows_to_move,columns_to_move)]
end
column_range(reference) click to toggle source
# File src/rewrite/ast_copy_formula.rb, line 38
def column_range(reference)
  raise NotSupportedException.new("Column ranges not suported in AstCopyFormula")
end
copy(ast) click to toggle source
# File src/rewrite/ast_copy_formula.rb, line 15
def copy(ast)
  return ast unless ast.is_a?(Array)
  operator = ast[0]
  if respond_to?(operator)
    send(operator,*ast[1..-1])
  elsif DO_NOT_MAP[operator]
    return ast
  else
    [operator,*ast[1..-1].map {|a| copy(a) }]
  end
end
row_range(reference) click to toggle source
# File src/rewrite/ast_copy_formula.rb, line 42
def row_range(reference)
  raise NotSupportedException.new("Row ranges not suported in AstCopyFormula")
end