class Reference

FIXME Make this a subclass of symbol

Attributes

excel_column[R]
excel_column_number[R]
excel_row[R]
excel_row_number[R]

Public Class Methods

column_letters_for_column_number() click to toggle source
# File src/excel/reference.rb, line 35
def self.column_letters_for_column_number
  @@column_letters_for_column_number
end
for(text) click to toggle source

This is so that we only have one instance of a given reference specified by its variables

# File src/excel/reference.rb, line 11
def Reference.for(text)
   @@references_for_text[text.to_s]
end

Public Instance Methods

calculate_excel_variables() click to toggle source
# File src/excel/reference.rb, line 41
def calculate_excel_variables
  return if @excel_variables_calculated
  self =~ /(\$)?([A-Za-z]{1,3})(\$)?([0-9]+)/
  @excel_fixed_column, @excel_column, @excel_fixed_row, @excel_row = $1, $2, $3, $4
  @excel_row_number = @excel_row.to_i
  @excel_column_number = @@column_number_for_column[@excel_column]
  @excel_variables_calculated = true
  self
end
offset(rows,columns) click to toggle source
# File src/excel/reference.rb, line 51
def offset(rows,columns)
  calculate_excel_variables
  new_column = @excel_fixed_column ? @excel_column :  @@column_letters_for_column_number[@excel_column_number + columns]
  new_row = @excel_fixed_row ? @excel_row : @excel_row_number + rows
  [@excel_fixed_column,new_column,@excel_fixed_row,new_row].join.to_sym
end
unfix() click to toggle source
# File src/excel/reference.rb, line 58
def unfix
  gsub("$","")
end