Class: RubyFromExcel::RuntimeFormulaBuilder
- Inherits:
-
FormulaBuilder
- Object
- FormulaBuilder
- RubyFromExcel::RuntimeFormulaBuilder
- Defined in:
- lib/runtime/runtime_formula_builder.rb
Constant Summary
Constants inherited from FormulaBuilder
FormulaBuilder::COMPARATOR_CONVERSIONS, FormulaBuilder::OPERATOR_CONVERSIONS
Instance Attribute Summary collapse
-
#refering_cell_reference ⇒ Object
Returns the value of attribute refering_cell_reference.
-
#worksheet ⇒ Object
Returns the value of attribute worksheet.
Attributes inherited from FormulaBuilder
Instance Method Summary collapse
- #indirect_function(text_formula) ⇒ Object
-
#initialize(worksheet, refering_cell_reference = nil) ⇒ RuntimeFormulaBuilder
constructor
A new instance of RuntimeFormulaBuilder.
- #named_reference(name) ⇒ Object
- #sheet_reference(sheet_name, reference) ⇒ Object (also: #quoted_sheet_reference)
- #table_reference(table_name, structured_reference) ⇒ Object
Methods inherited from FormulaBuilder
#area, #arithmetic, #attempt_to_calculate_index, #attempt_to_calculate_match, #attempt_to_parse_indirect, #boolean_false, #boolean_true, #brackets, #cell, #column_range, #comparator, #comparison, excel_function, #external_reference, #formula, #function, #index_function, #local_table_reference, #match_function, #null, #number, #operator, #parse_and_visit, #percentage, #prefix, #range_for, #row_range, #single_value_for, #standard_function, #string, #string_join
Constructor Details
#initialize(worksheet, refering_cell_reference = nil) ⇒ RuntimeFormulaBuilder
Returns a new instance of RuntimeFormulaBuilder.
7 8 9 10 |
# File 'lib/runtime/runtime_formula_builder.rb', line 7 def initialize(worksheet, refering_cell_reference = nil) self.worksheet = worksheet self.refering_cell_reference = refering_cell_reference end |
Instance Attribute Details
#refering_cell_reference ⇒ Object
Returns the value of attribute refering_cell_reference.
5 6 7 |
# File 'lib/runtime/runtime_formula_builder.rb', line 5 def refering_cell_reference @refering_cell_reference end |
#worksheet ⇒ Object
Returns the value of attribute worksheet.
5 6 7 |
# File 'lib/runtime/runtime_formula_builder.rb', line 5 def worksheet @worksheet end |
Instance Method Details
#indirect_function(text_formula) ⇒ Object
27 28 29 |
# File 'lib/runtime/runtime_formula_builder.rb', line 27 def indirect_function(text_formula) "indirect(#{text_formula.visit(self)},'#{formula_cell && formula_cell.reference}')" end |
#named_reference(name) ⇒ Object
23 24 25 |
# File 'lib/runtime/runtime_formula_builder.rb', line 23 def named_reference(name) name.to_method_name end |
#sheet_reference(sheet_name, reference) ⇒ Object Also known as: quoted_sheet_reference
12 13 14 |
# File 'lib/runtime/runtime_formula_builder.rb', line 12 def sheet_reference(sheet_name,reference) "s('#{sheet_name}').#{reference.visit(self)}" end |
#table_reference(table_name, structured_reference) ⇒ Object
18 19 20 21 |
# File 'lib/runtime/runtime_formula_builder.rb', line 18 def table_reference(table_name,structured_reference) table = worksheet.t(table_name) table.respond_to?(:reference_for) ? table.reference_for(structured_reference,refering_cell_reference).to_s : table end |