Class: RubyFromExcel::SingleCellArrayFormulaCell

Inherits:
FormulaCell show all
Defined in:
lib/cells/array/single_cell_array_formula_cell.rb

Instance Attribute Summary

Attributes inherited from FormulaCell

#ast, #original_formula

Attributes inherited from Cell

#dependencies, #reference, #worksheet, #xml_type, #xml_value

Instance Method Summary collapse

Methods inherited from FormulaCell

#debug, #parse_xml, #work_out_dependencies

Methods inherited from Cell

#alter_other_cells_if_required, #can_be_replaced_with_value?, #debug, #initialize, #inspect, #parse_xml, #test, #to_ruby, #to_s, #to_test, #tolerance_for, #value, #value_for_including, #work_out_dependencies

Constructor Details

This class inherits a constructor from RubyFromExcel::Cell

Instance Method Details

#ruby_valueObject


6
7
8
9
10
# File 'lib/cells/array/single_cell_array_formula_cell.rb', line 6

def ruby_value
  ruby_code = ast.visit(SingleCellArrayFormulaBuilder.new(self))
  ruby_code = "(#{ruby_code}).array_formula_offset(0,0)" if ruby_code =~ /^m\(.*\}$/
  "@#{reference.to_ruby} ||= #{ruby_code}"
end