class MapFormulaeToRuby

Constants

FUNCTIONS

Attributes

sheet_names[RW]
worksheet[RW]

Public Instance Methods

arithmetic(left,operator,right) click to toggle source
# File src/compile/ruby/map_formulae_to_ruby.rb, line 109
def arithmetic(left,operator,right)
  "#{FUNCTIONS[operator.last]}(#{map(left)},#{map(right)})"
end
array(*rows) click to toggle source
# File src/compile/ruby/map_formulae_to_ruby.rb, line 142
def array(*rows)
  "[#{rows.map {|r| map(r)}.join(",")}]"
end
brackets(*contents) click to toggle source
# File src/compile/ruby/map_formulae_to_ruby.rb, line 105
def brackets(*contents)
  "(#{contents.map { |a| map(a) }.join(',')})"
end
cell(reference) click to toggle source
# File src/compile/ruby/map_formulae_to_ruby.rb, line 134
def cell(reference)
  reference.to_s.downcase.gsub('$','')
end
comparison(left,operator,right) click to toggle source
# File src/compile/ruby/map_formulae_to_ruby.rb, line 122
def comparison(left,operator,right)
  "#{FUNCTIONS[operator.last]}(#{map(left)},#{map(right)})"
end
function(function_name,*arguments) click to toggle source
# File src/compile/ruby/map_formulae_to_ruby.rb, line 126
def function(function_name,*arguments)
  if FUNCTIONS.has_key?(function_name)
    "#{FUNCTIONS[function_name]}(#{arguments.map { |a| map(a) }.join(",")})"
  else
    raise NotSupportedException.new("Function #{function_name} not supported")
  end
end
prefix(symbol,ast) click to toggle source
# File src/compile/ruby/map_formulae_to_ruby.rb, line 100
def prefix(symbol,ast)
  return map(ast) if symbol == "+"
  return "negative(#{map(ast)})"
end
row(*cells) click to toggle source
# File src/compile/ruby/map_formulae_to_ruby.rb, line 146
def row(*cells)
  "[#{cells.map {|r| map(r)}.join(",")}]"
end
sheet_reference(sheet,reference) click to toggle source
# File src/compile/ruby/map_formulae_to_ruby.rb, line 138
def sheet_reference(sheet,reference)
  "#{sheet_names[sheet]}_#{map(reference)}"
end
string_join(*strings) click to toggle source
# File src/compile/ruby/map_formulae_to_ruby.rb, line 113
def string_join(*strings)
  strings = strings.map do |s|
    s = [:string, ""] if s == [:inlined_blank]
    s = map(s)
  end

  "string_join(#{strings.join(',')})"
end