Sha256: c5f16f0b8a79d48cbc8d94df92f507f6261eebe7c2fc4f3d85ea73cc7e4dd1f7

Contents?: true

Size: 905 Bytes

Versions: 15

Compression:

Stored size: 905 Bytes

Contents

module RubyFromExcel

  class RuntimeFormulaBuilder < FormulaBuilder
  
    attr_accessor :worksheet, :refering_cell_reference
  
    def initialize(worksheet, refering_cell_reference = nil)
      self.worksheet = worksheet
      self.refering_cell_reference = refering_cell_reference
    end
    
    def sheet_reference(sheet_name,reference)
      "s('#{sheet_name}').#{reference.visit(self)}"
    end
  
    alias :quoted_sheet_reference :sheet_reference
  
    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
  
    def named_reference(name)
      name.to_method_name
    end
  
    def indirect_function(text_formula)
      "indirect(#{text_formula.visit(self)},'#{formula_cell && formula_cell.reference}')"
    end
  
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
rubyfromexcel-0.0.23 lib/runtime/runtime_formula_builder.rb
rubyfromexcel-0.0.22 lib/runtime/runtime_formula_builder.rb
rubyfromexcel-0.0.21 lib/runtime/runtime_formula_builder.rb
rubyfromexcel-0.0.20 lib/runtime/runtime_formula_builder.rb
rubyfromexcel-0.0.19 lib/runtime/runtime_formula_builder.rb
rubyfromexcel-0.0.18 lib/runtime/runtime_formula_builder.rb
rubyfromexcel-0.0.17 lib/runtime/runtime_formula_builder.rb
rubyfromexcel-0.0.16 lib/runtime/runtime_formula_builder.rb
rubyfromexcel-0.0.13 lib/runtime/runtime_formula_builder.rb
rubyfromexcel-0.0.10 lib/runtime/runtime_formula_builder.rb
rubyfromexcel-0.0.9 lib/runtime/runtime_formula_builder.rb
rubyfromexcel-0.0.7 lib/runtime/runtime_formula_builder.rb
rubyfromexcel-0.0.6 lib/runtime/runtime_formula_builder.rb
rubyfromexcel-0.0.5 lib/runtime/runtime_formula_builder.rb
rubyfromexcel-0.0.4 lib/runtime/runtime_formula_builder.rb